参考链接

索引设计基本认识

Mysql执行计划

官网链接: https://dev.mysql.com/doc/refman/8.4/en/explain-output.html

执行计划适用范围

并非所有操作都可用执行计划分析,执行计划一般支持这些操作:SELECT, INSERT, DELETE, UPDATE, REPLACE

执行计划的顺序

执行计划会列出涉及每张表的执行计划,并且按照解析顺序依次在执行计划中列出。也就是查询优化器认为应该最先扫描的表(一般根据表结构、大小、索引信息分析)会放在第一行,以此类推。执行计划的每行对应的是一张表的分析。

执行计划列

Column JSON Name Meaning
id select_id The SELECT identifier
select_type None The SELECT type
table table_name The table for the output row
partitions partitions The matching partitions
type access_type The join type
possible_keys possible_keys The possible indexes to choose
key key The index actually chosen
key_len key_length The length of the chosen key
ref ref The columns compared to the index
rows rows Estimate of rows to be examined
filtered filtered Percentage of rows filtered by table condition
Extra None Additional information
  • 第二列说明
  • 第二列为null什么意思
  • JSON properties which are NULL are not displayed in JSON-formatted EXPLAIN output. 什么意思