I set alter session set nls_comp=LINGUISTIC; alter session set nls_sort=BINARY_CI;
I create this index:
create index titolo_indx on
table (nlssort(campo, 'NLS_SORT=BINARY_CI'));
If I execute this query:
select * from ri01_prodotti where titolo like 'A storage ring f%'
Oracle doesn't user the index.
SQL_ID 7yvspnyf96vp8, child number 0
select * from ri01_prodotti where titolo like 'A storage ring%'
Plan hash value: 350479533
| Id |
Operation |
Name |
Rows |
Bytes |
Cost (%CPU) |
Time |
| 0 |
SELECT STATEMENT |
|
|
|
2020 (100) |
|
| * 1 |
TABLE ACCESS FULL |
TABLE |
1 |
1365 |
2020 (1) |
00:00:25 |
Predicate Information (identified by operation id):
1 - filter("CAMPO" LIKE 'A storage ring%')
If I execute a query with =, oracle use index.
select * from table where campo ='A storage ring for crystalline beam studies'
SQL_ID 5jzr5nm6b37pq, child number 0
select * from ri01_prodotti where titolo ='A storage ring for crystalline beam
studies'
Plan hash value: 3866031381
| Id |
Operation |
Name |
Rows |
Bytes |
Cost (%CPU) |
Time |
| 0 |
SELECT STATEMENT |
|
|
|
151 (100) |
|
| 1 |
TABLE ACCESS BY INDEX ROWID |
RI01_PRODOTTI |
377 |
502K |
151 (0) |
00:00:02 |
| * 2 |
INDEX RANGE SCAN |
TITOLO_INDX |
151 |
|
3 (0) |
00:00:01 |
Predicate Information (identified by operation id):
2 - access("RI01_PRODOTTI"."SYS_NC00078$"=HEXTORAW('612073746F726167652072696E6720
666F72206372797374616C6C696E65206265616D207374756469657300') )