Introduction to MySQL explain

explain each field description

id selection identifier ( the sequence number of the query )

select_type : the type of query

table : the table of the output result set

partitions : matching partitions

type : access type (performance: ALL <index <range <ref <eq_ref <const <system <NULL)

possible_keys : possible indexes

key : the index actually used

key_len : the number of bytes used in the index

ref : Which column of the index is used

rows : the number of rows scanned (estimated number of rows)

filtered : Percentage of rows filtered by table conditions

Extra : Other important instructions for the implementation

 

Where type access type description

ALL
    full table scan. (Exception: limit is used in the query, or "Using distinct/not exist" is displayed in the Extra column)

index
    scans the entire table in index order. (Avoid sorting but bear the overhead of reading the entire table in index order. If "Using index" is displayed in the Extra column, it means that a covering index is used. It only scans the indexed data instead of each row in the index order. The overhead It is smaller than a full table scan in index order.)

range
    uses an index to retrieve rows in a given range. (Usually appear in between, >, etc.)

ref
    index search. (Usually it appears when using a non-unique index or a non-unique prefix of a unique index)

qe_ref
    index to find unique value. (Usually occurs in the use of primary key or unique index)

const and system are
    converted to constant access. (For example: select the primary key of a row by putting the primary key of a row in the where clause)

NULL
    does not need to access the table or index. (For example: selecting the minimum value from an index column can be done by searching the index separately, without accessing the table when it is executed)

Guess you like

Origin blog.csdn.net/Anenan/article/details/114525818