[数据分片]HASH型分片算法-YYYYMM
YYYYMM
仅用于分库
(YYYY*12+MM)%分库数.MM是1-12
create table travelrecord (
....
) ENGINE=InnoDB DEFAULT CHARSET=utf8
dbpartition by YYYYMM(xxx) dbpartitions 8
tbpartition by xxx(xx) tbpartitions 12;
"travelrecord":{
"createTableSQL":"CREATE TABLE db1.travelrecord (\n\t`id` bigint(22) NOT NULL\n) ENGINE = InnoDB CHARSET = utf8\nDBPARTITION BY YYYYMM(id) DBPARTITIONS 12",
"function":{
"properties":{
"dbNum":"36",
"mappingFormat":"prototype/db1/travelrecord_${ 2022+(index.toInteger()-1).intdiv(12) }_${ if(index.toInteger()==0)return 'any'; var i= (index.toInteger()).mod(12); if(i==0)return '12'; return i; }",
"storeNum":1,
"dbMethod":"YYYYMM(id)"
}
},
"shardingIndexTables":{}
}