covering index 是在innodb 1.0以后的版本实现的,这个索引的原理是查询的数据不需要回表查询数据,只需要在索引中就能找到需要的数据。

下面是mysql文档的解释:

covering index

An index that includes all the columns retrieved by a query. Instead of using the index values as pointers to find the full table rows, the query returns values from the index structure, saving disk I/O. InnoDB can apply this optimization technique to more indexes than MyISAM can, because InnoDB secondary indexes also include the primary key columns. InnoDB cannot apply this technique for queries against tables modified by a transaction, until that transaction ends.

Any column index or composite index could act as a covering index, given the right query. Design your indexes and queries to take advantage of this optimization technique wherever possible.



大体意思是:索引包含查询的所有列,不需要查询所有列,只需要从索引中就可以取回需要的数据,节省了i/o,。。。

第二段说的是合理设计索引,让查询通过convering index查询会成为可能