首页 > 数据库 >mysql分区命令

mysql分区命令

时间:2022-11-08 11:12:32浏览次数:38  
标签:ENGINE LESS 分区 PARTITION 命令 VALUES mysql InnoDB THAN

CREATE TABLE t_vocality_message (
VOCALITY_MESSAGE_ID int(50) unsigned NOT NULL AUTO_INCREMENT COMMENT '文本消息ID',
S_ID varchar(50) DEFAULT NULL COMMENT '录音主键',
CALL_ID varchar(50) DEFAULT NULL COMMENT '呼叫流水号',
AGENT_NO varchar(20) DEFAULT NULL COMMENT '坐席工号',
SPEAKER varchar(8) DEFAULT NULL COMMENT '发言人:agent(坐席)、user(用户)',
SEG_ID int(32) DEFAULT NULL COMMENT '排序,从0开始',
RECORD_TEXT varchar(2000) DEFAULT NULL COMMENT '文本内容',
SIGN_RECORD_TEXT varchar(2000) DEFAULT NULL COMMENT '带标签的文本',
TIME varchar(20) DEFAULT NULL COMMENT '时间戳 (yyMMddHHmmssSSSS)',
IS_END varchar(255) DEFAULT NULL COMMENT '是否最后通话:yes 是、no 否',
CALLER_NO varchar(20) DEFAULT NULL COMMENT '主叫号码',
BEGIN_TIME datetime DEFAULT NULL COMMENT '接通时间(待定) (yyMMddHHmmss)',
END_TIME datetime DEFAULT NULL COMMENT '挂机时间(待定) (yyMMddHHmmss)',
SUMMARY_STATUS varchar(8) DEFAULT NULL COMMENT '电话小结生成状态(待定):yes 有、no 无',
SPEED varchar(8) DEFAULT NULL COMMENT '语速:fast 快、slow 慢',
VOLUME varchar(8) DEFAULT NULL COMMENT '声音:big 大、small 小',
VOLUME_NUM float DEFAULT NULL COMMENT '语调值,语调大小',
SENSITIVE varchar(255) DEFAULT NULL COMMENT '敏感词',
DISABLE varchar(255) DEFAULT NULL COMMENT '禁用语',
KEYWORD varchar(255) DEFAULT NULL COMMENT '关键字',
BG varchar(10) DEFAULT NULL COMMENT '句子起始时间(ms)',
ED varchar(10) DEFAULT NULL COMMENT '句子结束时间(ms)',
FIXED_VALUES varchar(1000) DEFAULT NULL COMMENT '无固定值返回关键字',
UNIQUE KEY VOCALITY_MESSAGE_ID (VOCALITY_MESSAGE_ID,BEGIN_TIME),
KEY call_id_index (CALL_ID),
KEY idx_id_agentno (CALL_ID,AGENT_NO),
KEY idx_AGENT_NO (AGENT_NO),
KEY idx_Begin_time (BEGIN_TIME)
) ENGINE=InnoDB AUTO_INCREMENT=1326422505 DEFAULT CHARSET=utf8
PARTITION BY RANGE COLUMNS(BEGIN_TIME)(
PARTITION P202212 VALUES LESS THAN ('20230101') ENGINE = InnoDB,
PARTITION P202301 VALUES LESS THAN ('20230201') ENGINE = InnoDB,
PARTITION P202302 VALUES LESS THAN ('20230301') ENGINE = InnoDB,
PARTITION P202303 VALUES LESS THAN ('20230401') ENGINE = InnoDB,
PARTITION P202304 VALUES LESS THAN ('20230501') ENGINE = InnoDB,
PARTITION P202305 VALUES LESS THAN ('20230601') ENGINE = InnoDB,
PARTITION P202306 VALUES LESS THAN ('20230701') ENGINE = InnoDB,
PARTITION P202307 VALUES LESS THAN ('20230801') ENGINE = InnoDB,
PARTITION P202308 VALUES LESS THAN ('20230901') ENGINE = InnoDB,
PARTITION P202309 VALUES LESS THAN ('20231001') ENGINE = InnoDB,
PARTITION P202310 VALUES LESS THAN ('20231101') ENGINE = InnoDB,
PARTITION P202311 VALUES LESS THAN ('20231201') ENGINE = InnoDB,
PARTITION P202312 VALUES LESS THAN ('20240101') ENGINE = InnoDB,
PARTITION P202401 VALUES LESS THAN ('20240201') ENGINE = InnoDB,
PARTITION P202402 VALUES LESS THAN ('20240301') ENGINE = InnoDB,
PARTITION P202403 VALUES LESS THAN ('20240401') ENGINE = InnoDB,
PARTITION P202404 VALUES LESS THAN ('20240501') ENGINE = InnoDB,
PARTITION P202405 VALUES LESS THAN ('20240601') ENGINE = InnoDB,
PARTITION P202406 VALUES LESS THAN ('20240701') ENGINE = InnoDB,
PARTITION P202407 VALUES LESS THAN ('20240801') ENGINE = InnoDB,
PARTITION P202408 VALUES LESS THAN ('20240901') ENGINE = InnoDB,
PARTITION P202409 VALUES LESS THAN ('20241001') ENGINE = InnoDB,
PARTITION P202410 VALUES LESS THAN ('20241101') ENGINE = InnoDB,
PARTITION P202411 VALUES LESS THAN ('20241201') ENGINE = InnoDB,
PARTITION P202412 VALUES LESS THAN ('20250101') ENGINE = InnoDB,
PARTITION P202501 VALUES LESS THAN ('20250201') ENGINE = InnoDB,
PARTITION P202502 VALUES LESS THAN ('20250301') ENGINE = InnoDB,
PARTITION P202503 VALUES LESS THAN ('20250401') ENGINE = InnoDB,
PARTITION P202504 VALUES LESS THAN ('20250501') ENGINE = InnoDB,
PARTITION P202505 VALUES LESS THAN ('20250601') ENGINE = InnoDB,
PARTITION P202506 VALUES LESS THAN ('20250701') ENGINE = InnoDB,
PARTITION P202507 VALUES LESS THAN ('20250801') ENGINE = InnoDB,
PARTITION P202508 VALUES LESS THAN ('20250901') ENGINE = InnoDB,
PARTITION P202509 VALUES LESS THAN ('20251001') ENGINE = InnoDB,
PARTITION P202510 VALUES LESS THAN ('20251101') ENGINE = InnoDB,
PARTITION P202511 VALUES LESS THAN ('20251201') ENGINE = InnoDB,
PARTITION P202512 VALUES LESS THAN ('20260101') ENGINE = InnoDB,
PARTITION pMAX VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB
)

--新增分区
--1.先删除分区表pMAX
alter table t_vocality_message drop PARTITION pmax;
--2.再新增分区
ALTER TABLE t_vocality_message add PARTITION (
PARTITION P202601 VALUES LESS THAN ('20260201') ENGINE = InnoDB,
PARTITION pMAX VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB
)

标签:ENGINE,LESS,分区,PARTITION,命令,VALUES,mysql,InnoDB,THAN
From: https://www.cnblogs.com/leasing/p/16869003.html

相关文章