Issuing a query with more than one predicate can cause a blocking operation in the execution plan. For example, consider the following mixed query:
select docid from mytab where contains(text, 'oracle', 1) > 0 AND colA > 5 AND colB > 1 AND colC > 3;
Assume that all predicates are unselective and colA, colB, and colC have bitmap indexes. The cost-based optimizer in Oracle Database chooses the following execution plan:
TABLE ACCESS BY ROWIDS BITMAP CONVERSION TO ROWIDS BITMAP AND BITMAP INDEX COLA_BMX BITMAP INDEX COLB_BMX BITMAP INDEX COLC_BMX BITMAP CONVERSION FROM ROWIDS SORT ORDER BY DOMAIN INDEX MYINDEX
Because the BITMAP
AND
is a blocking operation, Oracle Text must temporarily save the rowid and score pairs returned from the Oracle Text domain index before running the BITMAP
AND
operation.
Oracle Text attempts to save these rowid and score pairs in memory. However, when the size of the result set containing these rowid and score pairs exceeds the SORT_AREA_SIZE
initialization parameter, Oracle Text spills these results to temporary segments on disk.
Because saving results to disk causes extra overhead, you can improve performance by increasing the SORT_AREA_SIZE
parameter using ALTER
SESSION
as follows:
alter session set SORT_AREA_SIZE = <new memory size in bytes>;
For example, to set the buffer to approximately 8 megabytes, enter:
alter session set SORT_AREA_SIZE = 8300000;
Oracle Database Performance Tuning Guide and Oracle Database Reference for more information on SORT_AREA_SIZE