MySQL Forums
Forum List  »  Partitioning

Re: Partitioning by date, and maintaining uniqueness
Posted by: Rick James
Date: August 31, 2013 05:35PM

> INSERT INTO TableName (id, created) VALUES (1000,'2013-08-14 17:30:00');

Since id is AUTO_INCREMENT, do not do it that way. Instead do either of these:
INSERT INTO TableName (id, created) VALUES (NULL,'2013-08-14 17:30:00');
INSERT INTO TableName (created) VALUES ('2013-08-14 17:30:00');
Either will create the 'next' id, and you will have no dups, regardless of the indexes you have.

> this is purely theoretical as there is no reason for anyone to manually insert an id, but mistakes do happen!!

True. This is one mistake that MySQL, with PARTITIONs, will not catch. I consider it only a minor drawback of PARTITIONs.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Partitioning by date, and maintaining uniqueness
1188
August 31, 2013 05:35PM


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.