Re: Prunning partitions with range by date (SOLVED)
Thanks Aftab. Your solution worked perfectly. Problem solved. The new CREATE TABLE statement is:
CREATE TABLE `test` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`ins_date` datetime NOT NULL,
PRIMARY KEY (`id`, `ins_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
PARTITION BY RANGE COLUMNS (`ins_date`) (
PARTITION pre_year VALUES LESS THAN ('2012-01-01'),
PARTITION cur_year_jan VALUES LESS THAN ('2012-02-01'),
PARTITION cur_year_feb VALUES LESS THAN ('2012-03-01'),
PARTITION cur_year_mar VALUES LESS THAN ('2012-04-01'),
PARTITION cur_year_may VALUES LESS THAN ('2012-05-01'),
PARTITION cur_year_apr VALUES LESS THAN ('2012-06-01'),
PARTITION cur_year_jun VALUES LESS THAN ('2012-07-01'),
PARTITION cur_year_jul VALUES LESS THAN ('2012-08-01'),
PARTITION cur_year_aug VALUES LESS THAN ('2012-09-01'),
PARTITION cur_year_sep VALUES LESS THAN ('2012-10-01'),
PARTITION cur_year_oct VALUES LESS THAN ('2012-11-01'),
PARTITION cur_year_nov VALUES LESS THAN ('2012-12-01'),
PARTITION cur_year_dec VALUES LESS THAN ('2013-01-01'),
PARTITION nex_year VALUES LESS THAN (MAXVALUE)
);
Edited 2 time(s). Last edit at 11/29/2012 01:06PM by Diogo Domanski.