MySQL Forums
Forum List  »  Partitioning

Cannot partition the table
Posted by: Pavel Baranov
Date: December 29, 2008 03:10PM

| username_profiles2 | CREATE TABLE `username_profiles2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username_id` int(11) DEFAULT NULL,
`profile_id` int(11) DEFAULT NULL,
`site_id` smallint(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,`site_id`),
UNIQUE KEY `user_profile_site` (`username_id`,`profile_id`,`site_id`)
) ENGINE=InnoDB AUTO_INCREMENT=17000000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci /*!50100 PARTITION BY LIST (site_id) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB, PARTITION p1 VALUES IN (1) ENGINE = InnoDB) */ |

WORKS!

But now I try to partition by range(id):
alter table username_profiles2 partition by range(id) (partition m0 values less than (10000000), partition m1 values less than (20000000), partition m2 values less than (30000000), partition m3 values less than (40000000), partition m4 values LESS THAN(MAXVALUE));
ERROR 1503 (HY000): A UNIQUE INDEX must include all columns in the table's partitioning function

What does UNIQUE has to do with Primary Key ?!?!!??

P.S. and NO i don't want to have a unique constraint on all 4 columns - that's retarded ...



Edited 1 time(s). Last edit at 12/29/2008 03:14PM by Pavel Baranov.

Options: ReplyQuote


Subject
Views
Written By
Posted
Cannot partition the table
7153
December 29, 2008 03:10PM
3529
December 30, 2008 12:07AM
3235
January 01, 2009 06:03AM


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.