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

相关文章:

  • 2022-01-01
  • 2021-10-01
  • 2021-10-04
  • 2022-01-05
  • 2022-12-23
  • 2021-11-15
  • 2021-10-20
猜你喜欢
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
  • 2021-08-26
  • 2021-08-07
  • 2022-12-23
  • 2021-12-08
相关资源
相似解决方案