My Oracle Support Banner

$P is not cleaned up by a FULL OPTIMIZE (Doc ID 2284095.1)

Last updated on JULY 06, 2018

Applies to:

Oracle Text - Version 12.1.0.2 and later
Information in this document applies to any platform.

Symptoms

On : 12.1.0.2 version, Query on context index (contains)

The optimize for Oracle Text leaves records in $P table.

The optimize FULL index does NOT clean the $P table. So when records are deleted for whatever reason the optimize will take care of the tokens that are a part of the deleted documents in the $I table but it does not touch the $P table.

Steps to show the behavior:

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> create user rtest identified by rtest;

User created.

SQL> grant dba to rtest;

Grant succeeded.

SQL> conn rtest/rtest
Connected.
SQL> begin
ctx_ddl.create_preference('wl_tdrborp1', 'BASIC_WORDLIST');
ctx_ddl.set_attribute('wl_tdrborp1','SUBSTRING_INDEX', 'YES');
end;
/ 2 3 4 5

PL/SQL procedure successfully completed.

SQL> create table tab_tdrborp1(id number, data varchar2(200));

Table created.

SQL> create index idx_tdrborp1 on tab_tdrborp1(data) indextype is ctxsys.context parameters ('wordlist wl_tdrborp1');

Index created.

SQL> insert into tab_tdrborp1 values (1, 'oracle text');

1 row created.

SQL> insert into tab_tdrborp1 values (2, 'optimize rebuild');

1 row created.

SQL> insert into tab_tdrborp1 values (3, 'substring index');

1 row created.

SQL> insert into tab_tdrborp1 values (4, 'prefix index');

1 row created.

SQL> exec ctx_ddl.sync_index('idx_tdrborp1');

PL/SQL procedure successfully completed.

SQL> select count(*) from DR$IDX_TDRBORP1$P;

COUNT(*)
----------
31

SQL> delete from tab_tdrborp1 where id in (1,2,4);

5 rows deleted.

SQL> exec ctx_output.start_log('log_opt.txt');
exec ctx_ddl.optimize_index('idx_tdrborp1', 'rebuild');
exec ctx_output.end_log;

PL/SQL procedure successfully completed.

SQL>
PL/SQL procedure successfully completed.

SQL>
PL/SQL procedure successfully completed.

SQL>
select count(*) from DR$IDX_TDRBORP1$P;SQL>

COUNT(*)
----------
31

 

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.