MySQL索引技巧

2018-04-24T09:31:00

使用EXPLAIN来查看SQL语句的索引使用情况;

using index :使用覆盖索引的时候就会出现
using where:在查找使用索引的情况下,需要回表去查询所需的数据
using index condition:查找使用了索引,但是需要回表查询数据
using index & using where:查找使用了索引,但是需要的数据都在索引列中能找到,所以不需要回表查询数据

不在使用索引列上使用函数进行计算,否则会导致索引失效
使用 != 或 <> 或 is null 或 is not null 时无法使用索引

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »