Home  >  Article  >  Database  >  What are the attributes of mysql explain?

What are the attributes of mysql explain?

王林
王林forward
2023-06-01 22:18:13677browse

1, table

The table to be queried

2,type

Index query type, start with the best The order from worst to worst is: system>const>eq_ref>ref>range>index>ALL. Generally speaking, ensure that the query reaches at least the range level, and preferably reaches the ref.

3. possible_keys

Displays one or more indexes that may be applied to this table. If an index exists for the fields involved in the query, the index will be listed, but it may not necessarily be the index actually used by the query

4, key

, If it is NULL, the index is not used

If a covering index is used in the query, the index only appears in the key list

5, key_len

Indicates the number of bytes used in the index. This column can be used to calculate the length of the index used in the query. Without losing accuracy, the shorter the length, the better.

The value displayed by key_len is the possible length of the index field, not the actual length used. It is calculated based on the definition of the table, not retrieved from the table.

6, ref

Shows which column of the index is used, if possible, is a constant. Which columns or constants are used to find the values ​​on the index columns

7, rows

Based on the table statistics and index selection, roughly estimate the required records to be found Number of lines to be read

The above is the detailed content of What are the attributes of mysql explain?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete