mysql Partition(分区)初探(二)

2014-11-24 17:00:16 · 作者: · 浏览: 1
的.
执行
Sql代码
explain PARTITIONS select * from 20130117date_par
where create_time BETWEEN '2012-01-01' and '2012-01-02';
可以看出这个query只扫描了p2012这个分区.
而且分区表的好处在于维护比较方便.比如2009年的数据不需要了,分区表的方法为
Sql代码
alter table 20130117date_par drop PARTITION p2009
不到1s就行了
普通表为
Sql代码
delete from 20130117date
where create_time BETWEEN '2009-01-01' and '2010-01-01'
用了10.25s左右