MySQL Forums
Forum List  »  Partitioning

Add Partition with Subpartitions
Posted by: Mike Gent
Date: July 27, 2006 09:49AM

I have a table that I can add and delete partitions:

CREATE TABLE `AH1` (
`ID` bigint(20) unsigned NOT NULL,
`Summary` text NOT NULL,
`Reported` int(10) unsigned NOT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(FROM_UNIXTIME(Reported)))
(
PARTITION p20060701 VALUES LESS THAN (TO_DAYS('2006-07-02 00:00:00')),
PARTITION p20060702 VALUES LESS THAN (TO_DAYS('2006-07-03 00:00:00')),
PARTITION p20060703 VALUES LESS THAN (TO_DAYS('2006-07-04 00:00:00')),
PARTITION p20060704 VALUES LESS THAN (TO_DAYS('2006-07-05 00:00:00'))
);

Both the add and delete functions work as expected:

ALTER TABLE AH1 DROP PARTITION p20060701;
ALTER TABLE AH1 ADD PARTITION (PARTITION p20060705 VALUES LESS THAN (TO_DAYS('2006-07-06 00:00:00')));

If I have another table partitioned the same, but also includes subpartitions:

CREATE TABLE `AH2` (
`ID` bigint(20) unsigned NOT NULL,
`Summary` text NOT NULL,
`Reported` int(10) unsigned NOT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(FROM_UNIXTIME(Reported)))
SUBPARTITION BY KEY (ID)
SUBPARTITIONS 5 (
PARTITION p20060701 VALUES LESS THAN (TO_DAYS('2006-07-02 00:00:00')),
PARTITION p20060702 VALUES LESS THAN (TO_DAYS('2006-07-03 00:00:00')),
PARTITION p20060703 VALUES LESS THAN (TO_DAYS('2006-07-04 00:00:00')),
PARTITION p20060704 VALUES LESS THAN (TO_DAYS('2006-07-05 00:00:00'))
);

Deleting a partition works:

ALTER TABLE AH2 DROP PARTITION p20060701;

Adding a new partition crashes MySQL:

ALTER TABLE AH2 ADD PARTITION (PARTITION p20060705 VALUES LESS THAN (TO_DAYS('2006-07-06 00:00:00')));


This is definately a bug in that the database crashes, but I need to know if this is still the correct syntax. Running 5.1.11 on Windows.

Options: ReplyQuote


Subject
Views
Written By
Posted
Add Partition with Subpartitions
6006
July 27, 2006 09:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.