索引覆蓋:如果查詢的列恰好是索引的一部分,那么查詢只需要在索引文件上進行,不需要進行到磁盤中找數據,若果查詢得列不是索引的一部分則要到磁盤中找數據。
建表:
create table test_index( id int primary key auto_increment, name char(10) not null default ``, email char(10) not null default ``, index c (`id`,`name`) ) engine = Innodb charset utf8; insert into test_index (`name`,`email`) values ('datou','111@qq.com'); ,('datou','111@qq.com');
執行如下一條語句:
explain select id ,name from test_index ;
執行另一條語句看如何:
explain select id ,name ,email from test_index ;


