首页 > 其他 > 详细

explain extended;show warnings

时间:2014-08-26 15:07:16      阅读:337      评论:0      收藏:0      [点我收藏+]

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加上 

explain extended;show warnings

原文:http://www.cnblogs.com/lehao/p/3937101.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!