mysql 执行计划走分区

来源:互联网 发布:淘宝客 编辑:程序博客网 时间:2024/05/22 10:08
mysql> EXPLAIN PARTITIONS   select count(*) from  history where clock<1438876800;+----+-------------+---------+------------+-------+---------------+-----------+---------+------+------+--------------------------+| id | select_type | table   | partitions | type  | possible_keys | key       | key_len | ref  | rows | Extra                    |+----+-------------+---------+------------+-------+---------------+-----------+---------+------+------+--------------------------+|  1 | SIMPLE      | history | p20150806  | index | NULL          | history_1 | 12      | NULL | 5250 | Using where; Using index |+----+-------------+---------+------------+-------+---------------+-----------+---------+------+------+--------------------------+1 row in set (0.00 sec)mysql>  EXPLAIN PARTITIONS   select count(*) from  history where clock<143899999;+----+-------------+---------+------------+-------+---------------+-----------+---------+------+------+--------------------------+| id | select_type | table   | partitions | type  | possible_keys | key       | key_len | ref  | rows | Extra                    |+----+-------------+---------+------------+-------+---------------+-----------+---------+------+------+--------------------------+|  1 | SIMPLE      | history | p20150806  | index | NULL          | history_1 | 12      | NULL | 5250 | Using where; Using index |+----+-------------+---------+------------+-------+---------------+-----------+---------+------+------+--------------------------+1 row in set (0.00 sec)mysql>  EXPLAIN PARTITIONS   select count(*) from  history where clock<1439049600;+----+-------------+---------+-------------------------------+-------+---------------+-----------+---------+------+-------+--------------------------+| id | select_type | table   | partitions                    | type  | possible_keys | key       | key_len | ref  | rows  | Extra                    |+----+-------------+---------+-------------------------------+-------+---------------+-----------+---------+------+-------+--------------------------+|  1 | SIMPLE      | history | p20150806,p20150807,p20150808 | index | NULL          | history_1 | 12      | NULL | 71310 | Using where; Using index |+----+-------------+---------+-------------------------------+-------+---------------+-----------+---------+------+-------+--------------------------+1 row in set (0.00 sec)

0 0