explain extended;show warnings
mysql> explain extended select count(*) from xuehao;
+----+-------------+-------+------+---------------+------+---------+------+------+----------+------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+----------+------------------------------+
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Select tables optimized away |
+----+-------------+-------+------+---------------+------+---------+------+------+----------+------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+-------+------+-------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+-------------------------------------------------------------------+
| Note | 1003 | /* select#1 */ select count(0) AS `count(*)` from `lina`.`xuehao` |
+-------+------+-------------------------------------------------------------------+
sql真正被执行前优化其做了哪些sql改写。
| Level | Code | Message |
+-------+------+-------------------------------------------------------------------+
| Note | 1003 | /* select#1 */ select count(0) AS `count(*)` from `lina`.`xuehao` |
+-------+------+-------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql4.1开始引入了explain extended命令,通过explain extended加上