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

Deleting a Level-2 Partition from a Level-2 Partitioned Table

You can run ALTER TABLE DROP SUBPARTITION to delete a level-2 range or list partition from a level-2 partitioned table.

For example, delete the level-2 partition date_202005_channel1 from the level-2 partitioned table range_list_sales by specifying the partition name and update the global index.
ALTER TABLE range_list_sales DROP SUBPARTITION date_202005_channel1 UPDATE GLOBAL INDEX;
Alternatively, delete a level-2 partition corresponding to the partition value ('2020-05-08', '0') in the level-2 partitioned table range_list_sales. Global indexes become invalid after this command is executed because the UPDATE GLOBAL INDEX clause is not used.
ALTER TABLE range_list_sales DROP SUBPARTITION FOR ('2020-05-08', '0');
  • If the level-2 partitioned table has only one level-2 partition, the level-2 partition cannot be deleted using the ALTER TABLE DROP SUBPARTITION statement.
  • If the level-2 partition policy of a level-2 partitioned table is HASH, the level-2 partition cannot be deleted using the ALTER TABLE DROP SUBPARTITION statement.