mysql 索引问题-待完善!
2018-07-18 本文已影响0人
辛未_杨
表结构背景[和数据库数量级有关!]
对表t1的id字段做了索引

1. 如何判断是否走索引
explain select * from table where id = xxx;

2. in,between,like 是否走了索引?



结论:都不走索引!
3.包含了索引列是否会走索引?

结论:只要where中包含了索引列,且条件不是模糊匹配就走索引!
4.如何对索引列进行范围查询?

对表t1的id字段做了索引
explain select * from table where id = xxx;