2.对索引列使用了'%xx',如: select*from tb where id like'%1'
需要注意的不是所有使用like关键字的select 语句都无法使用索引,比如 select*from tb where id like'1%'就可以使用索引
3.在where子句中对列进行类型转换(其实也是使用到了函数)
4.在组合索引的第1列不是使用最多的列,如在下面3个查询语句中建立组合索引,按顺序包含col2,col1,id列; select*from tb where id='1'and col1='aa' select id,sum(col1) from tb groupby id select*from tb where id='2'and col2='bb'
则第一句和第二句无法使用到索引 所以需要注意组合索引的顺序
5.在where 子句中使用in关键字的某些句子
当在in关键字后面使用嵌套的select语句,将无法使用在该列上定义的索引
如: select * from
ta where
id in
(select id from tb where ....)