您的位置:首页 > 数据库 > MySQL

如何检查mysql中建立的索引是否生效的检测方法及相关参数说明

2018-03-06 09:48 691 查看
所使用的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
这列很重要,显示了连接使用了哪种类别,有无使用索引.
从最好到最差的连接类型为const、eq_reg、ref、range、indexhe和ALL

原文链接:https://www.cnblogs.com/sand-tiny/p/3977645.html http://blog.csdn.net/u014470581/article/details/68065590
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐