Like after% position does not go index problem
create table t2 as select * from dba_objects;——创建表create index idx_t2_name on t2(object_name);——创建索引set autotrace on ——开启执行计划跟踪select * from t2 where object_name like ‘DE%‘;——走索引select * from t2 where object_name like ‘%DE‘;——不走索引
Inconsistent query field type causes implicit conversions without indexing problems
create table t3(id varchar2(10),name varchar2(10));——创建表t3insert into t3 select * from dba_objects;——插入数据commit; ——提交create index idx_t3_id on t3(id);创建id索引set autotrace on——开启执行计划自动跟踪select * from t3 where id=7000;——不走索引,会出现隐式转换,filter(TO_NUMBER("ID")=7000)select * from t3 where id=‘7000‘;——走索引,cost大大提升
Another: Do not use SELECT ' * ' From ... When you write a select asterisk, Oracle queries the data dictionary for conversion to a specific column name, increasing the cost of Oracle, and suggests writing a specific field name.
Attached: index information for query tables
Select Index_name,index_type,table_owner,table_name,tablespace_name from user_indexes where table_name= ' T1 ';
An example analysis of Oracle query not going index