Mysql 解释计划
输出字段分为 id select_type table partitions type possible_keys key key_len ref rows filtered extra
1. select_type
INSERT DELETE UPDATE 增删改
查有多个
查询的类型,主要是用于区分普通查询、联合查询、子查询等复杂的查询
1、SIMPLE:简单的select查询,查询中不包含子查询或者union
(select * from atest1 t1 )
2、PRIMARY:查询中包含任何复杂的子部分,最外层查询则被标记为primary
(select * from atest1 where id = (select id from atest2 ) )
3、SUBQUERY:在select 或 where列表中包含了子查询
(同上)
4、DERIVED:在from列表中包含的子查询被标记为derived(衍生),mysql或递归执行这些子查询,把结果放在零时表里
2. table 表名
如果有别名,显示别名
3 partitions
查询使用到表分区的分区名。
4.type 核心属性
分为
system > const > eq_ref > ref > range > index > ALL
4.1 system:
无法重现
4.2 const
where 条件是主键
select * from atest1 where id =1 ;