MySQL EXPLAIN Extra Information Common execution plan extra information description

The Extra column of EXPLAIN output contains additional information about how MySQL parses the query. 

Using filesort

When the Query contains ORDER BY operations and the index cannot be used to complete the sorting operation, MySQL Query Optimizer will select the corresponding sorting algorithm to implement it. Sort from memory when there is less data, otherwise sort from disk.

Using index

Only use the information in the index tree to retrieve column information from the table (covering index), without having to perform other lookups to read the actual rows (no need to go back to the table). This strategy can be used when the query uses only columns that belong to a single index.

For InnoDB tables with a user-defined clustered index, even if no index is used in the Extra column, the index can also be used. This is the case if the type is an index and the key is PRIMARY.

Using index condition

Filter the index first, find all data rows that meet the index conditions after filtering the index, and then use other conditions in the WHERE clause to filter these data rows.

Using index for group-by

Data access is the same as the Using index. The required data only needs to be read from the index. When the GROUP BY or DISTINCT clause is used in the Query, if the grouping field is also in the index, the information in the Extra will be the Using index for group-by.

Using join buffer (Block Nested Loop), Using join buffer (Batched Key Access) 

Block Nested-Loop algorithm: Store the rows/result set of the outer loop into the join buffer, and compare each row of the inner loop with the records in the entire buffer, thereby reducing the number of inner loops. Mainly used when there is no index on the joined table.
Batched Key Access algorithm: When the joined table can use the index, the order is first, and then the joined table is retrieved. Sort these rows according to the index field, thus reducing random IO. If there is no index on the joined table, the old version of the BNL strategy (BLOCK Nested-loop) is used.

Using MRR

Based on auxiliary/secondary index query, random IO is reduced, and random IO is converted into sequential IO to improve query efficiency.

Using temporary

MySQL uses temporary tables to store temporary structures for subsequent processing. MySQL first creates temporary tables for the heap engine. If there is too much temporary data and exceeds the size of max_heap_table_size, it will automatically convert the temporary tables into MyISAM engine tables for use. .

Using where

The WHERE clause is used to limit the rows to be matched with the next table or sent to the client.

 

Reference: https://blog.csdn.net/poxiaonie/article/details/77757471


 

Guess you like

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