所使用的mysql函数explain
语法:
explain < table_name >
例如: explain select * from t3 where id=3952602;
explain输出结果
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
详解输出结果
第四列 type
这列很重要,显示了连接使用了哪种类别,有无使用索引.
语法:
explain < table_name >
例如: explain select * from t3 where id=3952602;
explain输出结果
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
详解输出结果
第四列 type
这列很重要,显示了连接使用了哪种类别,有无使用索引.
从最好到最差的连接类型为const、eq_reg、ref、range、indexhe和ALL
原文链接:https://www.cnblogs.com/sand-tiny/p/3977645.html
http://blog.youkuaiyun.com/u014470581/article/details/68065590

本文介绍了MySQL中使用EXPLAIN函数的方法及输出结果解析,重点讲解了type列的不同取值及其意义,帮助理解查询优化。

被折叠的 条评论
为什么被折叠?



