You can also optimize for response time using the related DOMAIN_INDEX_SORT
hint. Like FIRST_ROWS(n)
, when queries are optimized for response time, Oracle Text returns the first rows in the shortest time possible.
For example, you can use this hint as follows
select /*+ DOMAIN_INDEX_SORT */ pk, score(1), col from ctx_tab where contains(txt_col, 'test', 1) > 0 order by score(1) desc;
However, this hint is only rule-based. This means that Oracle Text always chooses the index which satisfies the ORDER BY
clause. This might result in sub-optimal performance for queries in which the CONTAINS
clause is very selective. In these cases, Oracle recommends that you use the FIRST_ROWS(n)
hint, which is fully cost-based.