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

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

使用示例

  • RANGE-RANGE类型的使用示例
    CREATE TABLE tbl_range_range (col1 INT, col2 INT, col3 varchar(20))
    PARTITION BY RANGE(col1)
    SUBPARTITION BY RANGE(col2)
    (
      PARTITION p0 VALUES LESS THAN (1000) (
        SUBPARTITION s0 VALUES LESS THAN(100),
        SUBPARTITION s1 VALUES LESS THAN(MAXVALUE)
      ),
      PARTITION p1 VALUES LESS THAN (2000)
      (
        SUBPARTITION s2 VALUES LESS THAN(100),
        SUBPARTITION s3 VALUES LESS THAN(200)
      ),
      PARTITION p2 VALUES LESS THAN (MAXVALUE)
      (
        SUBPARTITION s4 VALUES LESS THAN(200),
        SUBPARTITION s5 VALUES LESS THAN(400)
      )
    );
  • RANGE COLUMNS-RANGE类型的使用示例
    CREATE TABLE tbl_range_col_range (col1 INT, col2 INT, col3 INT)
    PARTITION BY RANGE COLUMNS(col1, col2)
    SUBPARTITION BY RANGE(col3)
    (
      PARTITION p1 VALUES LESS THAN(1000, MAXVALUE)(
        SUBPARTITION s0 VALUES LESS THAN(100),
        SUBPARTITION s1 VALUES LESS THAN(MAXVALUE)
      ),
      PARTITION p2 VALUES LESS THAN(2000, MAXVALUE)(
        SUBPARTITION s2 VALUES LESS THAN(100),
        SUBPARTITION s3 VALUES LESS THAN(200)
      ),
      PARTITION p3 VALUES LESS THAN(MAXVALUE, MAXVALUE)(
        SUBPARTITION s4 VALUES LESS THAN(200),
        SUBPARTITION s5 VALUES LESS THAN(400)
      )
    );
support.huaweicloud.com/usermanual-gaussdbformysql/gaussdbformysql_05_0321.html