您好,登錄后才能下訂單哦!
創建表分區語句:
CREATE TABLE `pub_point_test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`longitude` double(255,10) DEFAULT NULL,
`latitude` double(255,10) DEFAULT NULL,
`license` varchar(255) DEFAULT NULL,
`gatherTime` bigint(10) NOT NULL,
`clientId` varchar(255) DEFAULT NULL,
`speed` int(11) DEFAULT NULL,
`address` varchar(255) DEFAULT NULL,
`datetime` datetime DEFAULT NULL,
`vehicleId` int(10) DEFAULT NULL,
`mileage` double(255,3) DEFAULT '0.000' COMMENT '單位:百米',
`trackId` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`,`gatherTime`),
KEY `license_index` (`license`) USING BTREE,
KEY `gatherTime_index` (`gatherTime`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2594032 DEFAULT CHARSET=gbk
partition by range(gatherTime)
subpartition by hash(id)
subpartitions 20
(
partition p20170101 values less than ((TO_DAYS('2016-01-01'))),
partition p20170102 values less than ((TO_DAYS('2016-01-02')))
)
添加子分區語句
alter table pub_point_test add partition
(
partition p20170103 values less than ((TO_DAYS('2016-01-03'))),
partition p20170104 values less than ((TO_DAYS('2016-01-04')))
)
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。