第五章:索引的使用-覆盖索引

直接学习:https://edu.csdn.net/course/play/27328/370707
覆盖索引:
#1、什么是覆盖索引?覆盖索引又称为索引覆盖,即select中的数据列只从索引中就能得到,不必读取数据行,也就是只需扫描索引就可以得到查询结果。
#2、如何判断使用了索引覆盖?
当一个查询使用了索引覆盖,在查询分析器explain的extra列可以看到’'using index;
#3、示例代码如下:

show index from employee\G;
explain select * from employee where name= '柳锋'\G;
explain select id from employee where id =13\G;
explain select id from employee\G;
explain select name from employee \G;
explain select name,salary from employee\G;

explain select name,salary,dept from employee\G;
explain select name,salary,dept,sex from employee\G;
发布了107 篇原创文章 · 获赞 6 · 访问量 968

猜你喜欢

转载自blog.csdn.net/weixin_43597208/article/details/105484899
今日推荐