The challenge here is the "null-ness" of value_char. If the definition of the *column* is nullable, then in order to skip the table lookup, we'd need to parse the entire content of the catsearch parameters to prove that value_char (or the expressions being used to search it) guarantee not null. Whilst that is certainly doable, it is not something that I think is currently implemented.
Making the column non-null is an obvious solution that (might) be applicable here.
SQL> create table CVC
2 (
3 config_field_id NUMBER not null,
4 key_value NUMBER not null,
5 value_char VARCHAR2(2000),
6 program_id NUMBER not null,
7 ts DATE,
8 user_id NUMBER
9 ) ;
Table created.
SQL>
SQL> insert into cvc
2 select 100000000+rownum, 100000000+rownum, 'vc', mod(rownum,3), sysdate, rownum
3 from dual
4 connect by level <= 20000;
20000 rows created.
SQL> commit;
Commit complete.
SQL>
SQL>
SQL> begin
2 ctx_ddl.create_index_set('CVC_iset');
3 ctx_ddl.add_index('CVC_iset','config_field_id, key_value, program_id'); /* sub-index */
4 end;
5 /
PL/SQL procedure successfully completed.
SQL>
SQL> CREATE INDEX TEXTi_CVC on CVC(value_char) INDEXTYPE IS ctxsys.ctxcat
2 PARAMETERS ('index set CVC_iset');
Index created.
SQL>
SQL> exec dbms_stats.gather_table_stats('','CVC');
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL> set autotrace traceonly explain
SQL> select count(*)
2 from CVC
3 where catsearch(value_char, 'vc | pound', 'config_field_id = 100000409 and key_value = 100000409 and program_id = 1') > 0 ;
Execution Plan
----------------------------------------------------------
Plan hash value: 1442005353
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 15 | 2 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 15 | | |
|* 2 | DOMAIN INDEX | TEXTI_CVC | 1000 | 15000 | | |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("CTXSYS"."CATSEARCH"("VALUE_CHAR",'vc |
pound','config_field_id = 100000409 and key_value = 100000409 and
program_id = 1')>0)
SQL>
SQL> select count(value_char) -- or config_field_id or key_value or program_id
2 from CVC
3 where catsearch(value_char, 'vc | pound', 'config_field_id = 100000409 and key_value = 100000409 and program_id = 1') > 0 ;
Execution Plan
----------------------------------------------------------
Plan hash value: 2776781297
------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 15 | 30 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 15 | | |
| 2 | TABLE ACCESS BY INDEX ROWID| CVC | 1000 | 15000 | 30 (0)| 00:00:01 |
|* 3 | DOMAIN INDEX | TEXTI_CVC | | | | |
------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - access("CTXSYS"."CATSEARCH"("VALUE_CHAR",'vc | pound','config_field_id =
100000409 and key_value = 100000409 and program_id = 1')>0)
SQL>
SQL> select count(value_char) -- or config_field_id or key_value or program_id
2 from CVC
3 where catsearch(value_char, 'vc', 'config_field_id = 100000409 and key_value = 100000409 and program_id = 1') > 0 ;
Execution Plan
----------------------------------------------------------
Plan hash value: 2776781297
------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 15 | 30 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 15 | | |
| 2 | TABLE ACCESS BY INDEX ROWID| CVC | 1000 | 15000 | 30 (0)| 00:00:01 |
|* 3 | DOMAIN INDEX | TEXTI_CVC | | | | |
------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - access("CTXSYS"."CATSEARCH"("VALUE_CHAR",'vc','config_field_id = 100000409
and key_value = 100000409 and program_id = 1')>0)
SQL>
SQL> alter table cvc modify value_char not null;
Table altered.
SQL>
SQL> select count(*)
2 from CVC
3 where catsearch(value_char, 'vc | pound', 'config_field_id = 100000409 and key_value = 100000409 and program_id = 1') > 0 ;
Execution Plan
----------------------------------------------------------
Plan hash value: 1442005353
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 15 | 2 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 15 | | |
|* 2 | DOMAIN INDEX | TEXTI_CVC | 1000 | 15000 | | |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("CTXSYS"."CATSEARCH"("VALUE_CHAR",'vc |
pound','config_field_id = 100000409 and key_value = 100000409 and
program_id = 1')>0)
SQL>
SQL> select count(value_char) -- or config_field_id or key_value or program_id
2 from CVC
3 where catsearch(value_char, 'vc | pound', 'config_field_id = 100000409 and key_value = 100000409 and program_id = 1') > 0 ;
Execution Plan
----------------------------------------------------------
Plan hash value: 1442005353
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 15 | 2 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 15 | | |
|* 2 | DOMAIN INDEX | TEXTI_CVC | 1000 | 15000 | | |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("CTXSYS"."CATSEARCH"("VALUE_CHAR",'vc |
pound','config_field_id = 100000409 and key_value = 100000409 and
program_id = 1')>0)
SQL>
SQL>