mysql explain结果中Type的含义

摘自:https://dev.mysql.com/doc/workbench/en/wb-performance-explain.html

Table 7.1 Visual Explain Diagram Information

System Name Color Text on Visual Diagram Tooltip related information
SYSTEM Blue Single row: system constant Very low cost
CONST Blue Single row: constant Very low cost
EQ_REF Green Unique Key Lookup Low cost -- The optimizer is able to find an index that it can use to retrieve the required records. It is fast because the index search directly leads to the page with all the row data
REF Green Non-Unique Key Lookup Low-medium -- Low if the number of matching rows is small; higher as the number of rows increases
FULLTEXT Yellow Fulltext Index Search Specialized FULLTEXT search. Low -- for this specialized search requirement
REF_OR_NULL Green Key Lookup + Fetch NULL Values Low-medium -- if the number of matching rows is small; higher as the number of rows increases
INDEX_MERGE Green Index Merge Medium -- look for a better index selection in the query to improve performance
UNIQUE_SUBQUERY Orange Unique Key Lookup into table of subquery Low -- Used for efficient Subquery processing
INDEX_SUBQUERY Orange Non-Unique Key Lookup into table of subquery Low -- Used for efficient Subquery processing
RANGE Orange Index Range Scan Medium -- partial index scan
INDEX Red Full Index Scan High -- especially for large indexes
ALL Red Full Table Scan Very High -- very costly for large tables, but less of an impact for small ones. No usable indexes were found for the table, which forces the optimizer to search every row. This could also mean that the search range is so broad that the index would be useless.
UNKNOWN Black unknown Note: This is the default, in case a match cannot be determined

另外可参照https://dev.mysql.com/doc/refman/5.7/en/explain-output.html,用哪个版本的mysql就改成对应版本

你可能感兴趣的:(database)