MySQL manual version 5.0.20-MySQL optimization (2) (1) (3 ). The connection type is the same as that of ALL. The difference is that it only scans the index tree. It is usually faster than ALL because the index file is usually smaller than the data file. The field knowledge queried by MySQL has the same index connection type as ALL. The difference is that it only scans the index tree. It is usually faster than ALL because the index file is usually smaller than the data file. MySQL uses this connection type when the queried field knowledge is a separate part of the index.
ALL
Scan all the tables and combine the records obtained from the previous table. At this time, if the first table is not identified as const, it is not very good. In other cases, it is usually very bad. Normally, you can add indexes to quickly retrieve records from the table to avoid ALL.
Possible_keys
The possible_keys field indicates the index that MySQL may use when searching table records. Note that this field is completely independent from the table sequence displayed in the EXPLAIN statement. This means that the indexes contained in possible_keys may not be used in actual use. If the value of this field is NULL, it indicates that no index is used. In this case, you can check which fields in the WHERE clause are suitable for adding indexes to improve query performance. In this case, create an index and then use the EXPLAIN command to check the index. For details, see section "14.2.2 alter table Syntax ". If you want to see what indexes are available for the table, you can use show index from tbl_name.
Key
The key field shows the indexes actually used by MySQL. When no index is used, the value of this field is NULL. To enable MySQL to forcibly USE or IGNORE the INDEX list in the possible_keys field, you can USE the keyword force index, use index, or ignore index in the query statement. For MyISAM and BDB tables, you can use analyze table to ANALYZE which index is better. For tables of the MyISAM type, the same effect is achieved by running the command myisamchk -- analyze. For details, see chapter "14.5.2.1 analyze table Syntax" and "5.7.2 Table Maintenance and Crash Recovery ".
Key_len
The key_len field shows the index length used by MySQL. If the value of the key field is NULL, the index length is NULL. Note that the value of key_len tells you which indexes MySQL uses in the Union index.
The same is true for ALL. The difference is that it only scans the index tree. It is usually faster than ALL because the index file is usually smaller than the data file. Separate index of MySQL field knowledge in query...