Is mysql's innodb, overwritten by index anyway through clustered index queries?

I use only one primary key on the innodb, table and a clustered index (the default is a clustered index). In my query statement, the where condition is this primary key, but the query column is arbitrary. I found that the extra of the execution plan is not using index,. According to theory, the data field of the leaf node of the clustered index stores the whole row of data, no matter what my query column is, as long as the where condition is the primary key, you can get it from the clustered index.

but the result is that using index, occurs only if the query column is a primary key, otherwise extra is empty

one more question, does innodb support federated clustered indexes?

Mar.04,2021
The primary key leaf node of

innodb stores the entire row of data, but we should pay attention to the concept of overwriting index. the so-called overlay index is only a concept given that index columns cover the fields of your select. For innodb primary keys, although the entire row of data is stored, the primary key is not made up of all columns. Your example is that an id column is a primary key, and the overlay index is very simple. The fields of your select and the fields filtered by where are within the range of the index column, or you simply have no where condition. Instead, you only select a few columns in the index column. That is the overlay index


.

if the index contains all the data needed by the query , it becomes an overlay index, that is, it is usually said that there is no need to return to the table operation, that is, the leaf node of the index contains the data they are looking for (the hash index is not allowed). If any of your columns are not on the index node, they will not become an overlay index.

criteria: using explain , you can judge by the output extra column. For an index overlay query, it is displayed as using index , and the MySQL query optimizer determines whether there is an index override query before executing the query.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34af3-2bf4a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34af3-2bf4a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?