Skip to content

[哈希分片]RIGHT_SHIFT

jamie12221 edited this page Nov 29, 2020 · 1 revision

[数据分片]HASH型分片算法-RIGHT_SHIFT

RIGHT_SHIFT

RIGHT_SHIFT(字段名,位移数)

仅支持数值类型

分片值右移二进制位数,然后按分片数量取余

create table travelrecord( 
 ...
)ENGINE=InnoDB DEFAULT CHARSET=utf8 
dbpartition by RIGHT_SHIFT(id,4) dbpartitions 3
tbpartition by RIGHT_SHIFT(user_id,4) tbpartitions 3;
Clone this wiki locally