按照文档说的,key分区是用MySQL内部的Hash Function来进行处理的,我现在的需求是:
create table test(
id int not null primary key,
col2 varchar(20)
)
partition by key(id) partitions 4;insert into test(id,col2) values(7,'test1');
insert into test(id,col2) values(2,'test2'),(5,'test5'),(8,'test8');我想实现每一个不同的id记录放在一个分区里,例如id为2,5,7,8的记录分别放在p0,p1,p2,p3分区里,貌似用key分区不能实现啊。
create table test(
id int not null primary key,
col2 varchar(20)
)
partition by key(id) partitions 4;insert into test(id,col2) values(7,'test1');
insert into test(id,col2) values(2,'test2'),(5,'test5'),(8,'test8');我想实现每一个不同的id记录放在一个分区里,例如id为2,5,7,8的记录分别放在p0,p1,p2,p3分区里,貌似用key分区不能实现啊。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货