MYSQL 表的分区以及分区的重新划分

DROP TABLE IF EXISTS `t_task`;
CREATE TABLE `t_task` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID(自增长主键)',
  `agent_id` varchar(10) DEFAULT NULL COMMENT '工号',
  `user_id` int(11) DEFAULT NULL,
  `service_type` int(4) DEFAULT NULL COMMENT '业务类型',
  `task_code` varchar(50) DEFAULT NULL COMMENT '任务信息code',
  `brand` int(11) DEFAULT NULL COMMENT '品牌',
  `task_type` int(11) DEFAULT NULL COMMENT '任务类别',
  `name` varchar(50) DEFAULT NULL COMMENT '任务名称',
  `service_remark` int(11) DEFAULT NULL COMMENT '服务评价',
  `subinst_id` int(11) DEFAULT NULL COMMENT '用户id',
  `cust_id` int(11) DEFAULT NULL COMMENT '客户ID',
  `detail_id` int(11) DEFAULT NULL COMMENT '业务数据ID',
  `assigned_time` datetime DEFAULT NULL,
  `accepted_time` datetime DEFAULT NULL,
  `begin_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '任务开始时间',
  `end_time` datetime DEFAULT NULL,
  `plan_complete_time` datetime DEFAULT NULL,
  `reservation_time` datetime DEFAULT NULL,
  `outbound_config_code` varchar(50) DEFAULT NULL COMMENT '无法联系原因code',
  `call_num` int(11) DEFAULT NULL COMMENT '已拨打次数',
  `next_call_time` datetime DEFAULT NULL,
  `status` int(4) DEFAULT NULL COMMENT '状态, 1:新任务;2:待处理,3:处理中;4:已处理 ; 5回收',
  `assign_type` int(4) DEFAULT NULL COMMENT '分配方式',
  `distribution_mode` int(4) DEFAULT NULL COMMENT '任务分配模式:0 自动,1 手动',
  `questionnaire_code` varchar(50) DEFAULT NULL COMMENT '问卷编号',
  `survey_id` bigint(20) DEFAULT NULL COMMENT '调查问卷编号',
  `start_minutes` int(11) DEFAULT NULL COMMENT '提前开始分配的分钟数',
  `stop_minutes` int(11) DEFAULT NULL COMMENT '提前结束分配的分钟数',
  `is_limit` int(4) DEFAULT '0' COMMENT '外呼时间是否有限制:0 不限制,1 限制',
  `limit_time` int(11) DEFAULT '0' COMMENT '外呼完成和分配时间的最大时间间隔,单位为分',
  `priority` int(11) DEFAULT '1' COMMENT '优先级,1为最小,99为最大',
  `create_time` datetime DEFAULT NULL,
  `create_user_name` varchar(10) DEFAULT NULL COMMENT '创建人',
  `create_user_id` int(11) DEFAULT NULL COMMENT '创建人ID',
  `update_time` datetime DEFAULT NULL,
  `update_user_name` varchar(10) DEFAULT NULL COMMENT '最后修改人',
  `update_user_id` int(11) DEFAULT NULL COMMENT '最后修改人ID',
  `serialno` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`,`status`),
  KEY `idx_task_detailid` (`detail_id`),
  KEY `idx_task_userid` (`user_id`),
  KEY `idx_task_custId` (`cust_id`),
  KEY `idx_task_assginTime` (`assigned_time`),
  KEY `idx_task_code_type` (`task_code`,`task_type`)
) ENGINE=InnoDB AUTO_INCREMENT=63917 DEFAULT CHARSET=utf8 COMMENT='任务'
PARTITION by LIST(STATUS)(
PARTITION status65535 VALUES in (65535),
PARTITION status65535 VALUES in (65535),
)


alter table t_task add PARTITION (PARTITION status6 VALUES in(65280, 65281,65282, 65283 ,65285))
alter table t_task REORGANIZE PARTITION status6 INTO (PARTITION status6 VALUES in(65280, 65281,65282, 65283 ,65285,65284))
SELECT * FROM information_schema.PARTITIONS WHERE table_name='t_task'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值