性能分析
explain select ...
总共有这些个字段
![](https://img.haomeiwen.com/i12884771/731da8a567f6cf15.png)
-
select_type 字段详解
image.png
实例:
explain SELECT * from t_user UNION select * from t_user
![](https://img.haomeiwen.com/i12884771/6ed7ac43c0a67df2.png)
EXPLAIN select * from employee where dept_id in (select id from dept union select id from dept);
![](https://img.haomeiwen.com/i12884771/98ab302c043f58a8.png)
-
type
image.png
查询性能从最好到最差的排序是:
System>const>eq_ref>range>index>All
-
extra
image.png
-
索引优化
网友评论