mysql分区表

阅读更多
CREATE TABLE `test` (
  `id` bigint(19) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) DEFAULT NULL,
  `name1` varchar(200) DEFAULT NULL,
  `cre_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name_index1` (`name`),
  KEY `name1_index1` (`name1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8


PARTITION BY RANGE (id)

SUBPARTITION BY HASH(id) (


   PARTITION p0 VALUES LESS THAN (1000000)(
            SUBPARTITION s0,
            SUBPARTITION s1
),
    PARTITION p1 VALUES LESS THAN (2000000)(
            SUBPARTITION s2,
            SUBPARTITION s3
),
    PARTITION p2 VALUES LESS THAN (3000000)(
            SUBPARTITION s4,
            SUBPARTITION s5
),
    PARTITION p3 VALUES LESS THAN (4000000)(
            SUBPARTITION s6,
            SUBPARTITION s7
),
    PARTITION p4 VALUES LESS THAN (5000000)(
            SUBPARTITION s8,
            SUBPARTITION s9
),
    PARTITION p5 VALUES LESS THAN (6000000)(
            SUBPARTITION s10,
            SUBPARTITION s11
),
    PARTITION p6 VALUES LESS THAN (7000000)(
            SUBPARTITION s12,
            SUBPARTITION s13
),
    PARTITION p7 VALUES LESS THAN (8000000)(
            SUBPARTITION s14,
            SUBPARTITION s15
),
    PARTITION p8 VALUES LESS THAN (9000000)(
            SUBPARTITION s16,
            SUBPARTITION s17
),
    PARTITION p9 VALUES LESS THAN (10000000)(
            SUBPARTITION s18,
            SUBPARTITION s19
),
    PARTITION p10 VALUES LESS THAN (11000000)(
            SUBPARTITION s20,
            SUBPARTITION s21
),


    PARTITION p11 VALUES LESS THAN (12000000)(
            SUBPARTITION s22,
            SUBPARTITION s23
),
    PARTITION p12 VALUES LESS THAN (13000000)(
            SUBPARTITION s24,
            SUBPARTITION s25
),
    PARTITION p13 VALUES LESS THAN (14000000)(
            SUBPARTITION s26,
            SUBPARTITION s27
),
    PARTITION p14 VALUES LESS THAN (15000000)(
            SUBPARTITION s28,
            SUBPARTITION s29
),
    PARTITION p15 VALUES LESS THAN (16000000)(
            SUBPARTITION s30,
            SUBPARTITION s31
),
    PARTITION p16 VALUES LESS THAN (17000000)(
            SUBPARTITION s32,
            SUBPARTITION s33
),
    PARTITION p17 VALUES LESS THAN (18000000)(
            SUBPARTITION s34,
            SUBPARTITION s35
),
    PARTITION p18 VALUES LESS THAN (19000000)(
            SUBPARTITION s36,
            SUBPARTITION s37
),
    PARTITION p19 VALUES LESS THAN (20000000)(
            SUBPARTITION s38,
            SUBPARTITION s39
),
    PARTITION p20 VALUES LESS THAN (21000000)(
            SUBPARTITION s40,
            SUBPARTITION s41
),

    PARTITION p21 VALUES LESS THAN (22000000)(
            SUBPARTITION s42,
            SUBPARTITION s43
),
    PARTITION p22 VALUES LESS THAN (23000000)(
            SUBPARTITION s44,
            SUBPARTITION s45
),
    PARTITION p23 VALUES LESS THAN (24000000)(
            SUBPARTITION s46,
            SUBPARTITION s47
),
    PARTITION p24 VALUES LESS THAN (25000000)(
            SUBPARTITION s48,
            SUBPARTITION s49
),
    PARTITION p25 VALUES LESS THAN (26000000)(
            SUBPARTITION s50,
            SUBPARTITION s51
),
    PARTITION p26 VALUES LESS THAN (27000000)(
            SUBPARTITION s52,
            SUBPARTITION s53
),
    PARTITION p27 VALUES LESS THAN (28000000)(
            SUBPARTITION s54,
            SUBPARTITION s55
),
    PARTITION p28 VALUES LESS THAN (29000000)(
            SUBPARTITION s56,
            SUBPARTITION s57
),
    PARTITION p29 VALUES LESS THAN (30000000)(
            SUBPARTITION s58,
            SUBPARTITION s59
),
    PARTITION p30 VALUES LESS THAN (31000000)(
            SUBPARTITION s60,
            SUBPARTITION s61
),

    PARTITION p31 VALUES LESS THAN (32000000)(
            SUBPARTITION s62,
            SUBPARTITION s63
),
    PARTITION p32 VALUES LESS THAN (33000000)(
            SUBPARTITION s64,
            SUBPARTITION s65
),
    PARTITION p33 VALUES LESS THAN (34000000)(
            SUBPARTITION s66,
            SUBPARTITION s67
),
    PARTITION p34 VALUES LESS THAN (35000000)(
            SUBPARTITION s68,
            SUBPARTITION s69
),
    PARTITION p35 VALUES LESS THAN (36000000)(
            SUBPARTITION s70,
            SUBPARTITION s71
),
    PARTITION p36 VALUES LESS THAN (37000000)(
            SUBPARTITION s72,
            SUBPARTITION s73
),
    PARTITION p37 VALUES LESS THAN (38000000)(
            SUBPARTITION s74,
            SUBPARTITION s75
),
    PARTITION p38 VALUES LESS THAN (39000000)(
            SUBPARTITION s76,
            SUBPARTITION s77
),
    PARTITION p39 VALUES LESS THAN (40000000)(
            SUBPARTITION s78,
            SUBPARTITION s79
),
    PARTITION p40 VALUES LESS THAN (41000000)(
            SUBPARTITION s80,
            SUBPARTITION s81
),

    PARTITION p41 VALUES LESS THAN (42000000)(
            SUBPARTITION s82,
            SUBPARTITION s83
),
    PARTITION p42 VALUES LESS THAN (43000000)(
            SUBPARTITION s84,
            SUBPARTITION s85
),
    PARTITION p43 VALUES LESS THAN (44000000)(
            SUBPARTITION s86,
            SUBPARTITION s87
),
    PARTITION p44 VALUES LESS THAN (45000000)(
            SUBPARTITION s88,
            SUBPARTITION s89
),
    PARTITION p45 VALUES LESS THAN (46000000)(
            SUBPARTITION s90,
            SUBPARTITION s91
),
    PARTITION p46 VALUES LESS THAN (47000000)(
            SUBPARTITION s92,
            SUBPARTITION s93
),
    PARTITION p47 VALUES LESS THAN (48000000)(
            SUBPARTITION s94,
            SUBPARTITION s95
),
    PARTITION p48 VALUES LESS THAN (49000000)(
            SUBPARTITION s96,
            SUBPARTITION s97
),
    PARTITION p49 VALUES LESS THAN (50000000)(
            SUBPARTITION s98,
            SUBPARTITION s99
),
    PARTITION p50 VALUES LESS THAN (MAXVALUE)(
            SUBPARTITION s100,
            SUBPARTITION s101
)
);

你可能感兴趣的:(mysql分区表)