mysql慢查询优化之explain的各列含义

mysql> explain select customer_id,first_name,last_name from customer;
+----+-------------+----------+------+---------------+------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------+------+---------------+------+---------+------+------+-------+
| 1 | SIMPLE | customer | ALL | NULL | NULL | NULL | NULL | 599 | NULL |
+----+-------------+----------+------+---------------+------+---------+------+------+-------+
1 row in set (0.00 sec)

 返回各列的含义
extra列需要注意的返回值
Using filesort:看到这个的时候,查询就需要优化了
Using temporary 看到这个的时候,也需要优化,

http://www.imooc.com/video/3710

笔记

 

mysql> explain select max(payment_date) from payment\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: payment
         type: ALL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 16086
        Extra: NULL
1 row in set (0.00 sec)

mysql> 

 

posted on 2014-12-17 23:21  walter371  阅读(395)  评论(0编辑  收藏  举报

导航