mysql 大数据分区
博客专区 > leirane 的博客 > 博客详情
mysql 大数据分区
leirane 发表于3个月前
mysql 大数据分区
  • 发表于 3个月前
  • 阅读 1
  • 收藏 0
  • 点赞 0
  • 评论 0

CREATE TABLE
    t_rerecognitionresult_par
    (
        ID INT NOT NULL AUTO_INCREMENT,
        StationID CHAR(42) COLLATE utf8_general_ci DEFAULT '5' NOT NULL COMMENT '定义时,采用层级关系',
        PatrolDataID INT NOT NULL,
        DevicePartID CHAR(42) COLLATE utf8_general_ci NOT NULL COMMENT '定义时,采用层级关系',
        RecognitionType INT,
        RecognitionValue FLOAT,
        Unit CHAR(10),
        ValueShow CHAR(100),
        RecognitionTime DATETIME,
        ImageType INT,
        Coordinate longblob,
        IsAccurate TINYINT(1) COMMENT '是否经过模式识别  -  正确识别(鲁能内部用)',
        VerifyState TINYINT(1) COMMENT '人工识别是否认同机器人识别的结果(0:识别正确,1:错误)',
        VerifyResult FLOAT,
        VerifyIsAlarm TINYINT(1) COMMENT '识别结果 正常或异常(人工审核指定的,0或1)',
        IsAlarm TINYINT(1) COMMENT '机器人自动识别的对应VerifyIsAlarm(0:正常,1:报警)',
        VerifyBy CHAR(20) COLLATE utf8_general_ci COMMENT '审核人记录用户表ID(审核人)',
        VerifyOn DATETIME COMMENT ' 审核时间',
        IsVerified TINYINT(1) COMMENT '是否人工审核 (是否审核,0:未审核,1已审核)',
        CoordinateWeb CHAR(200) COLLATE utf8_general_ci,
        TaskRunHisID CHAR(50) NOT NULL,
        PRIMARY KEY (ID, StationID,RecognitionTime)
    )
    ENGINE=innodb DEFAULT CHARSET=gb2312
PARTITION BY RANGE (to_days(RecognitionTime))
(
PARTITION p0 VALUES LESS THAN (TO_DAYS('2017-02-01')) ENGINE = innodb,
PARTITION p1 VALUES LESS THAN (TO_DAYS('2017-03-01')) ENGINE = innodb,
PARTITION p2 VALUES LESS THAN (TO_DAYS('2017-04-01')) ENGINE = innodb,
PARTITION p3 VALUES LESS THAN (TO_DAYS('2017-05-01')) ENGINE = innodb,
 PARTITION p4 VALUES LESS THAN (TO_DAYS('2017-06-01')) ENGINE = innodb,
 PARTITION p5 VALUES LESS THAN (TO_DAYS('2017-07-01')) ENGINE = innodb,
 PARTITION p6 VALUES LESS THAN (TO_DAYS('2017-08-01')) ENGINE = innodb,
 PARTITION p7 VALUES LESS THAN (TO_DAYS('2017-09-01')) ENGINE = innodb,
 PARTITION p8 VALUES LESS THAN (TO_DAYS('2017-10-01')) ENGINE = innodb,
 PARTITION p9 VALUES LESS THAN (TO_DAYS('2017-11-01')) ENGINE = innodb,
 PARTITION p10 VALUES LESS THAN (TO_DAYS('2017-12-01')) ENGINE = innodb
 )

 

注意:分区的字段必须是主键

标签: mysql 分区形式
共有 人打赏支持
粉丝 3
博文 3
码字总数 1670
×
leirane
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: