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

时间:2024-09-11 14:19:52

使用示例

  • LIST-RANGE类型的使用示例
    CREATE TABLE tbl_list_range
    (
        col1 INT,
        col2 INT,
        col3 varchar(20),
        col4 DATE
    )
    PARTITION BY LIST (col1)
    SUBPARTITION BY RANGE(col2)
    (
      PARTITION p0 VALUES in (1, 2)(
        SUBPARTITION s0 VALUES LESS THAN(1000),
        SUBPARTITION s1 VALUES LESS THAN(2000)
      ),
      PARTITION p1 VALUES in (3, 4)(
        SUBPARTITION s2 VALUES LESS THAN(1000),
        SUBPARTITION s3 VALUES LESS THAN(MAXVALUE)
      ),
      PARTITION p2 VALUES in (5, 6)(
        SUBPARTITION s4 VALUES LESS THAN(3000),
        SUBPARTITION s5 VALUES LESS THAN(MAXVALUE)
      )
    );
  • LIST COLUMNS-RANGE类型的使用示例
    CREATE TABLE tbl_list_columns_range
    (
        col1 INT,
        col2 INT,
        col3 varchar(20),
        col4 DATE
    )
    PARTITION BY LIST COLUMNS(col3)
    SUBPARTITION BY RANGE(month(col4))
    (
      PARTITION europe VALUES in ('FRANCE', 'ITALY')(
        SUBPARTITION q1_2012 VALUES LESS THAN(4),
        SUBPARTITION q2_2012 VALUES LESS THAN(7)
      ),
      PARTITION asia VALUES in ('INDIA', 'PAKISTAN')(
        SUBPARTITION q1_2013 VALUES LESS THAN(4),
        SUBPARTITION q2_2013 VALUES LESS THAN(7)
      ),
      PARTITION americas VALUES in ('US', 'CANADA')(
        SUBPARTITION q1_2014 VALUES LESS THAN(4),
        SUBPARTITION q2_2014 VALUES LESS THAN(7)
      )
    );
support.huaweicloud.com/kerneldesc-gaussdbformysql/gaussdbformysql_20_0040.html