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

explain extended;show warnings

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

标签:os   ar   sp   ef   c   sql   type   mysql   table   

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

标签:os   ar   sp   ef   c   sql   type   mysql   table   

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

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