Updated on 2024-06-07 GMT+08:00

Enabling/Disabling Automatic Level-2 List Partitioning

You can run ALTER TABLE SET SUBPARTITIONING to enable or disable automatic level-2 list partitioning.

Examples:

  • Enable automatic partitioning of level-2 list partitioned tables.
    gaussdb=# CREATE TABLE range_list (c1 int, c2 int)
    PARTITION BY RANGE (c1) SUBPARTITION BY LIST (c2)
    (
        PARTITION p1 VALUES LESS THAN (5) (
            SUBPARTITION sp11 VALUES (1, 2, 3),
            SUBPARTITION sp12 VALUES (4, 5, 6)
        ),
        PARTITION p2 VALUES LESS THAN (10) (
            SUBPARTITION sp21 VALUES (1, 2, 3),
            SUBPARTITION sp22 VALUES (4, 5, 6)
        )
    );
    gaussdb=# ALTER TABLE range_list SET SUBPARTITIONING AUTOMATIC;

    To enable automatic level-2 list partitioning, ensure that no DEFAULT partition key exists in level-2 partitions.

  • Disable automatic partitioning of level-2 list partitioned tables.
    gaussdb=# ALTER TABLE range_list SET SUBPARTITIONING MANUAL;
    
    -- Cleanup example
    gaussdb=# DROP TABLE range_list;