您好,登錄后才能下訂單哦!
這是現實中的一個例子,但是我不推薦使用MySQL分區用于生產
CREATE?TABLE?`t_log`?( ??`ID`?int(11)?NOT?NULL?AUTO_INCREMENT?COMMENT?'主鍵ID', ??`VERSON`?int(11)?NOT?NULL?DEFAULT?0?COMMENT?'?版本號', ??`ACTIONS`?varchar(100)?DEFAULT?NULL?COMMENT?'?操作記錄', ??`ADMINID`?int(11)?DEFAULT?1?COMMENT?'管理員ID', ??`IP`?varchar(20)?DEFAULT?'1'?COMMENT?'?登錄Ip', ??`CDATE`?datetime?NOT?NULL?COMMENT?'添加時間', ??`UDATE`?datetime?NOT?NULL?COMMENT?'修改時間', ??PRIMARY?KEY?(`ID`,`CDATE`), ??KEY?`ADMINID`?(`ADMINID`)?USING?BTREE )?ENGINE=InnoDB???DEFAULT?CHARSET=utf8?COMMENT='日志表' Time:?0.024s ALTER?TABLE?`blog`.`t_log`?PARTITION?BY?RANGE?(year(`CDATE`)) PARTITIONS?1 SUBPARTITION?BY?HASH?(to_days(`CDATE`)) SUBPARTITIONS?4 (PARTITION?`p0`?VALUES?LESS?THAN?(2020)?? (SUBPARTITION?`s200`??, SUBPARTITION?`s201`??, SUBPARTITION?`s202`??, SUBPARTITION?`s203`??)) Time:?0.057s alter?table?t_log ADD?PARTITION?(PARTITION?`p1`?VALUES?LESS?THAN?(2021)( SUBPARTITION?`s210`?ENGINE?=?InnoDB, ??SUBPARTITION?`s211`?ENGINE?=?InnoDB, ??SUBPARTITION?`s212`?ENGINE?=?InnoDB, ??SUBPARTITION?`s213`?ENGINE?=?InnoDB )) Time:?0.054s
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。