码迷,mamicode.com
首页 > 其他好文 > 详细

explain select * from xuehao;

时间:2014-08-26 13:36:06      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:os   使用   on   ef   c   sql   type   mysql   table   

mysql> explain select * from xuehao;
+----+-------------+--------+------+---------------+------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+------+---------------+------+---------+------+------+-------+
| 1 | SIMPLE | xuehao | ALL | NULL | NULL | NULL | NULL | 8 | NULL |
+----+-------------+--------+------+---------------+------+---------+------+------+-------+
1 row in set (0.03 sec)

type

all 全表扫描,mysql遍历全表来找到匹配的行

index 索引全扫描,mysql遍历整个索引来查询匹配的行

range 索引范围扫描,常见于<,<=,>,>=,between等操作

ref 使用非唯一索引扫描或唯一索引的前缀扫描

eq_ref 使用的索引时唯一索引

const/system 表中最多有一个匹配行

NULL 不访问表或者索引,直接就能够得到结果

explain select * from xuehao;

标签:os   使用   on   ef   c   sql   type   mysql   table   

原文地址:http://www.cnblogs.com/lehao/p/3936981.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!