云数据库 GAUSSDB(FOR MYSQL)-HASH-RANGE:使用示例

时间:2024-08-02 14:04:08

使用示例

HASH-RANGE类型的使用示例

CREATE TABLE tbl_hash_range
(
    col1 INT,
    col2 INT,
    col3 varchar(20),
    col4 DATE
)
PARTITION BY HASH(col1)
SUBPARTITION BY RANGE(col2)
(
  PARTITION p0 (
    SUBPARTITION s0 VALUES LESS THAN(4),
    SUBPARTITION s1 VALUES LESS THAN(7),
    SUBPARTITION s2 VALUES LESS THAN(10),
    SUBPARTITION s3 VALUES LESS THAN(13)
  ),
  PARTITION p1
  (
    SUBPARTITION s4 VALUES LESS THAN(4),
    SUBPARTITION s5 VALUES LESS THAN(7),
    SUBPARTITION s6 VALUES LESS THAN(10),
    SUBPARTITION s7 VALUES LESS THAN(13)
  ),
  PARTITION p2
  (
    SUBPARTITION s8 VALUES LESS THAN(4),
    SUBPARTITION s9 VALUES LESS THAN(7),
    SUBPARTITION s10 VALUES LESS THAN(10),
    SUBPARTITION s11 VALUES LESS THAN(13)
  )
);
support.huaweicloud.com/usermanual-gaussdbformysql/gaussdbformysql_05_0327.html