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.
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
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)!