日期:2014-05-16 浏览次数:20747 次
-- 按月分区给个例子给你: ALTER TABLE mytest partition BY range(to_days(starttime)) ( partition p_2010 VALUES LESS THAN (to_days('2011-01-01')), partition p_201101 VALUES LESS THAN (to_days('2011-02-01')), partition p_201102 VALUES LESS THAN (to_days('2011-03-01')), partition p_201103 VALUES LESS THAN (to_days('2011-04-01')), partition p_201104 VALUES LESS THAN (to_days('2011-05-01')), partition p_201105 VALUES LESS THAN (to_days('2011-06-01')), partition p_201106 VALUES LESS THAN (to_days('2011-07-01')), partition p_201107 VALUES LESS THAN (to_days('2011-08-01')), partition p_201108 VALUES LESS THAN (to_days('2011-09-01')), partition p_201109 VALUES LESS THAN (to_days('2011-10-01')), partition p_201110 VALUES LESS THAN (to_days('2011-11-01')), partition p_201111 VALUES LESS THAN (to_days('2011-12-01')), partition p_201112 VALUES LESS THAN (to_days('2012-01-01')), partition p_2012 VALUES LESS THAN (to_days('2013-01-01')), partition p_max VALUES LESS THAN (maxvalue) );
------解决方案--------------------
用组合分区吧 单独分区的话 数据量还是太大
------解决方案--------------------
一周300W那按周来分区可以
------解决方案--------------------
按YEARWEEK分就行了。
partition BY range(YEARWEEK(starttime))