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

Enabling/Disabling Automatic Range Partitioning

You can run the ALTER TABLE SET INTERVAL command to enable or disable automatic range partitioning.

Enable automatic range partitioning.

gaussdb=# CREATE TABLE range_int (c1 int, c2 int) 
PARTITION BY RANGE (c1)
(
    PARTITION p1 VALUES LESS THAN (5),
    PARTITION p2 VALUES LESS THAN (10),
    PARTITION p3 VALUES LESS THAN (15)
);

gaussdb=# ALTER TABLE range_int SET INTERVAL (5);
  • To enable automatic range partitioning, ensure that no MAXVALUE partition key exists in the partitioned table.
  • Automatic range partitioning supports only level-1 partitioned tables and single-column partition keys.

Disable automatic range partitioning.

gaussdb=# ALTER TABLE range_int SET INTERVAL ();

-- Cleanup example
gaussdb=# DROP TABLE range_int;