MySQL Forums
Forum List  »  Partitioning

No other way than delete primary key to create partitions by single datetime columns?
Posted by: Sam Young
Date: August 20, 2015 08:00PM

Hi, I have a question, the table like this

CREATE TABLE `t1` (
`id` varchar(64) NOT NULL,
`createDate` datetime DEFAULT NULL,
`col3` int(11) DEFAULT NULL,
`col4` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

The table is so huge that I want partition it by `createDate` column to have a better select performance.

Partition like this:

ALTER TABLE t1 PARTITION BY RANGE COLUMNS (createDate)(
PARTITION p2015_6_1 VALUES less than ('2015-6-1'),
PARTITION p2015_7_1 VALUES less than ('2015-7-1'),
PARTITION pmax VALUES LESS THAN (MAXVALUE)
);

Is this no other way than delete primary key ?
Or some trick usage that partition it by a range column and keep the primary key ?

Options: ReplyQuote




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.