MySQL Partitioning Unique Key -
i following article:
http://www.chrismoos.com/2010/01/31/mysql-partitioning-tables-with-millions-of-rows
but when run query partition product table (that contains 500,000 rows) error:
#1503 - unique index must include columns in table's partitioning function my query is:
alter table parts_library partition hash(manufacturerid) partitions 200 my primary key compound key of id , manufacturerid, same in article, don't understand why getting error.
here create statement table:
create table if not exists `parts_library` ( `id` int(11) not null, `dateadded` timestamp not null default current_timestamp on update current_timestamp, `typeid` int(3) not null comment 'reference part_types', `manufacturerid` int(11) not null default '0', `familyid` int(11) not null default '454', `partnumber` varchar(255) collate utf8_unicode_ci not null comment 'e.g. 6es5123b62', `idealform` varchar(255) collate utf8_unicode_ci not null comment 'e.g. 6es5-123-b6/2', `comcodeid` int(11) default null, `countryoriginid` int(3) not null default '258', `minstocklevel` int(11) default null, `weight` decimal(11,2) default null, `width` decimal(11,2) default null, `height` decimal(11,2) default null, `depth` decimal(11,2) default null, `validated` tinyint(1) not null default '0', `onweb` tinyint(1) default '0', `indexed` tinyint(1) not null default '1', `averagemargin` decimal(11,2) not null, primary key (`id`,`manufacturerid`), unique key `partnumber` (`partnumber`), key `fk_parts_library_parts_categories1` (`typeid`), key `fk_parts_library_manufacturers1` (`manufacturerid`), key `fk_parts_library_geo_countries1` (`countryoriginid`), key `fk_parts_library_parts_families1` (`familyid`), key `indexed` (`indexed`) ) engine=innodb default charset=utf8 collate=utf8_unicode_ci; how can partition table?
the difference bewteen code , arcticle - have
unique key 'partnumber' ('partnumber')
which not mentioned in article. db complains need include column used partitioning key definition like:
unique key 'partnumber' ('manufacturerid','partnumber')
Comments
Post a Comment