下面是实际的分区表。
CREATE TABLE `idea_partition` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`mdn` varchar(45) NOT NULL,
`keyword` varchar(45) NOT NULL,
`circle` varchar(45) DEFAULT NULL,
`status` varchar(45) NOT NULL,
`mode` varchar(25) DEFAULT NULL,
`action` varchar(45) DEFAULT NULL,
`mobile_type` varchar(45) DEFAULT NULL,
`date` datetime NOT NULL,
`sunsign` varchar(45) DEFAULT NULL,
`numerology` int(10) unsigned DEFAULT NULL,
`unsubdate` datetime DEFAULT NULL,
`user` varchar(15) DEFAULT NULL,
`pass` varchar(15) DEFAULT NULL,
`refid` varchar(64) DEFAULT NULL,
`info` varchar(128) DEFAULT NULL,
`precharge` varchar(1) DEFAULT NULL,
`originator` varchar(15) DEFAULT NULL,
`price` double(6,2) DEFAULT NULL,
`renewal_count` int(11) DEFAULT '1',
PRIMARY KEY (`id`,`date`),
UNIQUE KEY `Index_on_mdn_keyword_status` (`mdn`,`keyword`,`status`,`date`),
KEY `Index_2` (`mdn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE( TO_DAYS(date) ) (
PARTITION rx201201 VALUES LESS THAN( TO_DAYS('2012-01-01 00:00:00') ),
PARTITION rx201202 VALUES LESS THAN( TO_DAYS('2012-02-01 00:00:00') ),
PARTITION rx201203 VALUES LESS THAN( TO_DAYS('2012-03-01 00:00:00') ),
PARTITION rx201204 VALUES LESS THAN( TO_DAYS('2012-04-01 00:00:00') ),
PARTITION rx201205 VALUES LESS THAN( TO_DAYS('2012-05-01 00:00:00') ),
PARTITION rx201206 VALUES LESS THAN( TO_DAYS('2012-06-01 00:00:00') ),
PARTITION rx201207 VALUES LESS THAN( TO_DAYS('2012-07-01 00:00:00') ),
PARTITION rx201208 VALUES LESS THAN( TO_DAYS('2012-08-01 00:00:00') ),
PARTITION rx201209 VALUES LESS THAN( TO_DAYS('2012-09-01 00:00:00') ),
PARTITION rxMORES VALUES LESS THAN (MAXVALUE) );
是否可以通过日期列上的分区在现有范围上添加新分区。如下图——
ALTER TABLE idea_partition partition (TO_DAYS(date)) partition rx201301 VALUES LESS THAN (TO_DAYS('2013-01-01 00:00:00');
它给我带来了错误..!! 但是有没有办法实现呢?