温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

list表分区&后续添加分区

发布时间:2020-07-24 22:01:46 来源:网络 阅读:815 作者:阿山哥258 栏目:开发技术


创建表分区语句:


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')))

)


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI