mysql之explain分析表

SQL

EXPLAIN SELECT * from test where id IN(select id from test where age<>1)

结果
在这里插入图片描述
#id

标识

#select_type

select语句类型
SIMPLE:简单查询  PRIMARY:主查询 DEPENDENT UNION:取决外面查询 UNION RESET:连接查询结果
SUBQUERY:子查询中的第一个SELECT DEPENDENT SUBQUERY:子查询中的第一个SELECT UNION:取决外面查询

#table

使用索引的表名

#type

表的连接类型【查询优化级别至少达到range】
system>const>eq_ref>ref>ref_or_null>index_merge>unique_subquery>index_subquery>range>index>all
表的连接类型详解:
https://blog.csdn.net/qq_40673786/article/details/90038593

#possible_keys

查询中所有可能会用到的索引名称

#key

实际用到的索引名称

#key_len

包含所使用索引的最长关键元素

#ref

表示使用哪个列或常量与索引一起来查询记录

#rows

查询时必须检索的行数

#Extra

查询语句的详细信息

下一篇:https://blog.csdn.net/qq_40673786/article/details/90041291

猜你喜欢

转载自blog.csdn.net/qq_40673786/article/details/90039032