###命令介绍
MySQL的EXPLAIN命令用于SQL语句的查询执行计划(QEP)。
这条命令的输出结果能够让我们了解MySQL 优化器是如何执行
执行下面的SQL
1 | explain select * FROM book where name like '活%' |
得到下面的数据
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filered | Extra |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 编号 | 查询方式 | 表名 | 分区 | 连接方式 | 索引(可能) | 索引 | 索引长度 | 作用列 | 行数 | 百分比 | 额外 |
| 1 | SIMPLE | book | null | ALL | null | null | null | null | 114 | 11.11 | Using where |
1 | #创建个人信息表 |
###执行计划样例
1 | explain select zipcode,firstname,lastname from hisen_test_explain_people; |
###参考