表
t(
a varchar(2048)
)create index idx on t(trim(a));select * from t where trim(a) = 'test';explain plan 中就是TABLE ACCESS FULL。
已经
set QUERY_REWRITE_ENABLED = TRUE
SET QUERY_REWRITE_INTEGRITY = TRUSTED加入hint
select /* + index (t, idx) */* from t where trim(a) = 'test';
结果还是一样
t(
a varchar(2048)
)create index idx on t(trim(a));select * from t where trim(a) = 'test';explain plan 中就是TABLE ACCESS FULL。
已经
set QUERY_REWRITE_ENABLED = TRUE
SET QUERY_REWRITE_INTEGRITY = TRUSTED加入hint
select /* + index (t, idx) */* from t where trim(a) = 'test';
结果还是一样
1,CBO
2,analyze index
analyze table t compute statistics
for table
for all indexes
for all indexed columns;再看你的执行计划吧