MySQL explain使用方法
type
Post
status
Published
date
Feb 26, 2024
slug
mysql-explain-usage
summary
tags
MySQL
category
技术分享
icon
password
explain 各字段解释

- select_type:查询类型
- SIMPLE:简单查询
- PRIMARY:最外层查询
- UNION:union 后续查询
- SUBQUERY:子查询
- type:
- ALL:全表(性能最差)
- index:基于索引的全表
- range:范围
- ref:非唯一索引单值查询
- const:使用主键或者唯一索引等值查询
- possible_keys:可能用到的索引
- key:真正用到的索引
- rows:预估扫描多少行记录
- key_len:使用了索引的字节数
- Extra:额外信息
- Using where:索引会标
- Using index:索引直接满足条件
- Using filesort:需要排序
- Using temproary:使用到临时表