SELECT_TYPE:
1) SIMPLE:简单的SELECT,不实用UNION或者子查询
mysql> explain select * from t2;
+----+-------------+-------+------+---------------+------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+-------+
| 1 | SIMPLE | t2 | ALL | NULL | NULL | NULL | NULL | 100 | NULL |
+----+-------------+-------+------+---------------+------+---------+------+------+-------+
1 row in set (0.00 sec)
2) PRIMARY:最外层SELECT。
mysql> explain select * from (select * from t2 where id2=2) b;
+----+-------------+------------+------+---------------+------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+----
版权声明:本文为BSKnight原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。