explain返回字段解析

2020-03-26  本文已影响0人  3anLouYouGu1

explain返回字段

id:

默认1 子查询则编号增加

select_type:

simple 简单查询

primary 子查询或派生查询
subquery 非from子查询
derived from子查询
union
union result

table:

表名、别名、派生表名

type:

all 全表扫描
index 按索引顺序的全表扫描 innodb还会回表取数据
range 范围的索引扫描
ref 查找条件列使用了索引而且不为主键和unique
eq_ref 使用了主键或者唯一性索引进行查找
const、system、null 常量级别

possible_key:

可能命中的索引

key:

实际命中的索引

key_len:

索引的最大长度

ref:

连接查询时,与其他表的引用关系

rows:

估计扫描行数

Extra:

using index 最好
using where 其次
using temporary
using filesort
range checked for each record

上一篇 下一篇

猜你喜欢

热点阅读