码迷,mamicode.com
首页 > 数据库 > 详细

mysql分区

时间:2018-01-16 12:17:33      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:utf8   partition   ons   not   sel   body   row   nod   rom   

分区创建表sql

CREATE TABLE `tb_original` (
`id` varchar(50) NOT NULL,
`task_source` varchar(200) DEFAULT NULL,
`address_id` varchar(50) DEFAULT NULL,
`norm_address` varchar(1000) CHARACTER SET utf8mb4 DEFAULT NULL,
`address_freq` varchar(200) DEFAULT NULL,
`adcode` varchar(255) DEFAULT NULL,
`zno_code` varchar(200) DEFAULT NULL,
`team_code` varchar(200) DEFAULT NULL,
`worker_id` varchar(200) DEFAULT NULL COMMENT ‘原始表‘,
`city_code` varchar(200) DEFAULT NULL,
`sss_teamcode` varchar(200) DEFAULT NULL,
`sss_znocode` varchar(200) DEFAULT NULL,
`sch_teamcode` varchar(200) DEFAULT NULL,
`sch_znocode` varchar(200) DEFAULT NULL,
`insert_date` datetime DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`file_name` varchar(50) DEFAULT NULL,
`city_adcode` varchar(200) NOT NULL,
PRIMARY KEY (`id`,city_adcode)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
PARTITION BY LIST COLUMNS(city_adcode) (
PARTITION p000 VALUES IN (‘000‘),
PARTITION p010 VALUES IN (‘010‘),
PARTITION p020 VALUES IN (‘020‘),
PARTITION p021 VALUES IN (‘021‘),
PARTITION p027 VALUES IN (‘027‘),
PARTITION p028 VALUES IN (‘028‘),
PARTITION p512 VALUES IN (‘512‘),
PARTITION p571 VALUES IN (‘571‘),
PARTITION p755 VALUES IN (‘755‘),
PARTITION p769 VALUES IN (‘769‘)
);


insert into tb_original select *,‘010‘ from tb_original_010;
insert into tb_original select *,‘020‘ from tb_original_020;
insert into tb_original select *,‘021‘ from tb_original_021;

查看分区情况

SELECT PARTITION_NAME,TABLE_ROWS
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_NAME = ‘tb_original‘

mysql分区

标签:utf8   partition   ons   not   sel   body   row   nod   rom   

原文地址:https://www.cnblogs.com/quying1019/p/8295670.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!