首页 > 代码库 > Mysql的分区

Mysql的分区

DROP TABLEIF EXISTS et_msg_201703;CREATE TABLEIF NOT EXISTS et_user_msg_201703 (    `mid` BIGINT auto_increment ,    `send_username` VARCHAR (255) NOT NULL COMMENT 发送消息者,    `receive_username` VARCHAR (255) NOT NULL COMMENT 接受消息者,发送者发送的对象,    `video_source_id` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 分享视频的来源地址:0,youtube;1,facebook;2,ted,    `video_thumb_url` VARCHAR (255),    `videoId` VARCHAR (255) DEFAULT ‘‘ COMMENT 视频的videoId,    `share_url` VARCHAR (255),    `share_title` VARCHAR (255),    `share_text` TEXT,    `share_time` INT (11),    `share_status` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 0,未读;1,已读,    `share_type` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 0,分享类消息;1,聊天类消息,    KEY (send_username),    PRIMARY key (mid,share_time),    KEY (receive_username),    KEY (        send_username,        receive_username,        share_status    )) ENGINE = INNODB charset = utf8 PARTITION BY RANGE (share_time)(    PARTITION p1    VALUES        LESS THAN (1488322800),        PARTITION p2    VALUES        LESS THAN (1488409200),        PARTITION p3    VALUES        LESS THAN (1488495600),        PARTITION p4    VALUES        LESS THAN (1488582000),        PARTITION p5    VALUES        LESS THAN (1488668400),        PARTITION p6    VALUES        LESS THAN (1488754800),        PARTITION p7    VALUES        LESS THAN (1488841200),        PARTITION p8    VALUES        LESS THAN (1488927600),        PARTITION p9    VALUES        LESS THAN (1489014000),        PARTITION p10    VALUES        LESS THAN (1489100400),        PARTITION p11    VALUES        LESS THAN (1489186800),        PARTITION p12    VALUES        LESS THAN (1489273200),        PARTITION p13    VALUES        LESS THAN (1489359600),        PARTITION p14    VALUES        LESS THAN (1489446000),        PARTITION p15    VALUES        LESS THAN (1489532400),        PARTITION p16    VALUES        LESS THAN (1489618800),        PARTITION p17    VALUES        LESS THAN (1489705200),        PARTITION p18    VALUES        LESS THAN (1489791600),        PARTITION p19    VALUES        LESS THAN (1489878000),        PARTITION p20    VALUES        LESS THAN (1489964400),        PARTITION p21    VALUES        LESS THAN (1490050800),        PARTITION p22    VALUES        LESS THAN (1490137200),        PARTITION p23    VALUES        LESS THAN (1490223600),        PARTITION p24    VALUES        LESS THAN (1490310000),        PARTITION p25    VALUES        LESS THAN (1490396400),        PARTITION p26    VALUES        LESS THAN (1490482800),        PARTITION p27    VALUES        LESS THAN (1490565600),        PARTITION p28    VALUES        LESS THAN (1490652000),        PARTITION p29    VALUES        LESS THAN (1490738400),        PARTITION p30    VALUES        LESS THAN (1490824800),        PARTITION p31    VALUES        LESS THAN (1490911200));

 

Mysql的分区