Help Center/ GaussDB/ Feature Guide(Centralized_3.x)/ Partitioned Table/ Partitioned Table O&M Management/ SPLIT PARTITION/ Splitting a Level-2 Partition for a Level-2 *-Range Partitioned Table
Updated on 2024-05-20 GMT+08:00

Splitting a Level-2 Partition for a Level-2 *-Range Partitioned Table

You can run ALTER TABLE SPLIT SUBPARTITION to split a level-2 partition for a level-2 *-range partitioned table.

For example, assume that the defined range of the level-2 partition channel1_customer4 of a level-2 *-range partitioned table list_range_sales is [1000, MAXVALUE). You can specify the split point 1200 to split the channel1_customer4 level-2 partition into two partitions and update the global index.
ALTER TABLE list_range_sales SPLIT SUBPARTITION channel1_customer4 AT (1200) INTO
(
    SUBPARTITION channel1_customer4_p1, -- The upper boundary of the first partition is 1200.
    SUBPARTITION channel1_customer4_p2  -- The upper boundary of the second partition is MAXVALUE.
) UPDATE GLOBAL INDEX;
Alternatively, split the partition channel1_customer4 into multiple partitions without specifying a split point, and update the global index.
ALTER TABLE list_range_sales SPLIT SUBPARTITION channel1_customer4 INTO
(
    SUBPARTITION channel1_customer4_p1 VALUES LESS THAN (1200),
    SUBPARTITION channel1_customer4_p2 VALUES LESS THAN (1400),
    SUBPARTITION channel1_customer4_p3 -- The upper boundary of the third partition is MAXVALUE.
)UPDATE GLOBAL INDEX;
Alternatively, split the partition by specifying the partition value instead of the partition name.
ALTER TABLE range_sales SPLIT SUBPARTITION FOR ('1', 1200) AT (1200) INTO
(
    PARTITION channel1_customer4_p1,
    PARTITION channel1_customer4_p2
) UPDATE GLOBAL INDEX;

If the MAXVALUE partition is split, the MAXVALUE range cannot be declared for the first several partitions, and the last partition inherits the MAXVALUE range.