MySQL Forums
Forum List  »  Partitioning

Re: Partitioning problem
Posted by: Scott Noyes
Date: October 08, 2008 08:00AM

Resolving to day is not required; you can go clear down to the second if you like. But you do have to provide an integer to the expression and not a datetime, except in the case of partitioning by KEY.

Phil is right in that if you have a PRIMARY or UNIQUE key, it must include any columns that appear in the partitioning expression. But remember that auto_increment doesn't require a PRIMARY key, so you can do something like this:


CREATE TABLE mytable(
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
dt DATETIME NOT NULL,
INDEX(id)
)
PARTITION BY RANGE (TIME_TO_SEC(dt)) (
PARTITION p1 VALUES LESS THAN (TIME_TO_SEC('2008-08-08 00:00:00')),
PARTITION p2 VALUES LESS THAN (TIME_TO_SEC('2008-08-08 02:00:00')),
PARTITION p3 VALUES LESS THAN MAXVALUE
);

Options: ReplyQuote


Subject
Views
Written By
Posted
5132
August 31, 2008 03:49AM
2455
September 04, 2008 12:19PM
2536
September 06, 2008 01:17PM
Re: Partitioning problem
2370
October 08, 2008 08:00AM
2252
October 08, 2008 10:56PM


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.