ORACLE 用不上索引的情况
1、not,<> ,与 null 值比较这几种情况使用不上索引;
2、like通配符只是出现在后面能够用上索引,例如:like 'luo%'。
通配符出现在前面用不上索引,例如:like '%jun'。
3、索引列的选择性不高的时候也用不上索引,例如一个表有个字段只有四种可能的值,数据表中有100成条记录,如果在这个只有四种可能的字段上建立索引,也不会使用到。
4、索引列是否是函数的参数,如果是,则使用不上。例如:
select * from tb_merp_schedul_log t where to_char(t.input_time,'yyyy-mm-dd hh24:mi:ss')<= '2009-04-28 09:00:00';
修改后可以用索引:
select * from tb_merp_schedul_log t where t.input_time <= to_date('yyyy-mm-dd hh24:mi:ss', '2009-04-28 09:00:00');