explain SELECT * FROM teacher WHERE tname = "张三" order by tcid
tname上建立了索引
没有order by tcid时候,extra为null
有order by tcid时候用了using index condition
如果这个sql是explain SELECT * FROM teacher WHERE tname > "张三" order by tcid
使用了using index condition我能理解,如果只是tname = "张三",只是用索引定位到数据,并没有筛选
因为 explain SELECT * FROM teacher WHERE tname = "张三"时候并没有using where,所以并没有筛选
我的问题是:explain SELECT * FROM teacher WHERE tname = "张三" order by tcid 为何使用到了 using index condition?
这篇关于索引条件下推写得不错,你可能参考下: https://www.cnblogs.com/zengk...