MySQL Forums
Forum List  »  Partitioning

How to partition by a period of time
Posted by: Eva Mukhija
Date: December 11, 2007 03:43AM

Hi,

I want to partition my table in 3 partitions such that the first partition contains for the last 15 days, the second contain data for 16-90 days and the third partition contains data beyond 90 days. I understand that I need to periodically move data between the partitions. Is there any way in mysql that I can do it. Also, I am writing the following syntax to create partitions, but its not working

CREATE TABLE tbl_history(
id VARCHAR(20) NOT NULL,
timestamp DATETIME NOT NULL,
PRIMARY KEY(id, timestamp)
)
TYPE=InnoDB
PARTITION BY RANGE(TO_DAYS(CURDATE())-TO_DAYS(timestamp))
(PARTITION P0 VALUES LESS THAN(16),
PARTITION P1 VALUES LESS THAN(91),
PARTITION P2 VALUES LESS THAN MAXVALUE )
;
Whenever I execute this statement I get 'ERROR 1064 (42000): Constant/Random expression in (sub)partitioning function is
not allowed near ')'

Options: ReplyQuote


Subject
Views
Written By
Posted
How to partition by a period of time
4944
December 11, 2007 03:43AM
2764
December 13, 2007 01:27AM


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.