查询语句索引不能使用的一些状况

1. not 用不了索引数据库

2. <> 用不了索引函数

3. null值比较用不了索引spa

4. like 索引

   select * from emp where ename like 'luo%' --能用上class

    select * from emp where ename like '%dai' --不能date

5. 查询字段使用了函数select

   select * from emp where to_char(reg_date,'yyyy')='2009'service

   固然,还包括了||链接符,对查询字段作运算等,如: where age+1=30 数据类型

6. 多个字段创建组合索引 数据

  如对班号,姓名创建索引,而且班号在前

  where class_no='200105302' and stu_name= '罗某' --能够用索引

  where class_no='200105302'                        --能够

  where stu_name='罗某'                             --不能够

7. 注意数据类型隐式转换的问题

service_type字段,数据库表里varchar2类型,可是像下面这样写

where service_type=82 --用不了,隐式类型转换

相关文章
相关标签/搜索