MySQL Forums
Forum List  »  Partitioning

how to partition a table with string type unique column .
Posted by: qufu dai
Date: August 14, 2012 01:40AM

I want to use partition in mysql version 5.1.49 。


but i was trapped when i use below sql :

ALTER TABLE members
PARTITION BY HASH (usernames)
PARTITIONS 5;
--------------------------------------------
part of create table sql :


CREATE TABLE `members` (
`uid` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT ,
`username` varchar(50) NULL DEFAULT NULL ,
`password` char(32) NOT NULL DEFAULT '' ,
PRIMARY KEY (`uid`),
UNIQUE INDEX `username` USING BTREE (`username`) ,
INDEX `email` USING BTREE (`email`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=4290615
ROW_FORMAT=COMPACT
;

in document , i was told to use hash (Integer) . but the unique index has a String type . so how can i transfer column 'username' to Integer type ?

update my mysql version would be the only choice ? (seem mysql 5.6version could support hash(String) )

any sugguestion is welcome . i just want to partition a table with string type unique column .



Edited 2 time(s). Last edit at 08/14/2012 01:54AM by qufu dai.

Options: ReplyQuote


Subject
Views
Written By
Posted
how to partition a table with string type unique column .
4617
August 14, 2012 01:40AM


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.