Home >Database >Mysql Tutorial >Mysql-index coverage

Mysql-index coverage

黄舟
黄舟Original
2017-01-20 17:09:131443browse

The index is a data structure that is convenient for searching, and it is also cached in memory. It is very fast to use the index to find the physical row address, but it will be slower to extract the required field values ​​​​from the physical row (return). .

Querying the index is fast, but using the index to find all the data you want from the physical disk (return) is slow.

Mysql-index coverage


As shown above, the index is usename. If the selected field has id, username, age... then you have to go to the physical row to extract the data ;If you select id, it will be stored in the index, so you don’t need to look for it and you will be satisfied.

Summary: The content of the query happens to be in the index, and there is no need to go back and search. This situation is called index coverage


Mysql-index coverage

If the above Using appears The index part means that a covering index is used.

The innodb engine goes one step further on the covering index:

The innodb engine all stores the primary key ID, transaction ID, rollback pointer, non-primary key ID,

his query Even non-primary key IDs can also be overwritten to obtain the primary key ID.

The above is the content covered by Mysql-index. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Mysql-clustered indexNext article:Mysql-clustered index