索引覆盖

select username,area,age from table where username='li' 通过索引找到username,在去磁盘找area,age

select username from table where username='li' 这个用到了索引覆盖,索引中有username的数据,不需要去磁盘找

索引覆盖:

索引覆盖是指 如果查询的列恰好是索引的一部分,那么查询只需要在索引文件上进行,不需要回行到磁盘再找数据.

这种查询速度非常快,称为”索引覆盖”

explain sql 中的extra出现using index 说明使用了索引覆盖

原文地址:https://www.cnblogs.com/microtiger/p/7561049.html