Updated on 2024-05-20 GMT+08:00

Deleting a Partition from a Level-2 Partitioned Table

You can run ALTER TABLE DROP PARTITION to delete a range or list partition from a level-2 partitioned table. The database deletes the partition and all level-2 partitions under the partition.

For example, delete the partition date_202005 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 PARTITION date_202005 UPDATE GLOBAL INDEX;
Alternatively, delete a partition corresponding to the partition value ('2020-05-08') 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 PARTITION FOR ('2020-05-08');
  • If a level-2 partitioned table has only one partition, the partition cannot be deleted using the ALTER TABLE DROP PARTITION statement.
  • If the level-1 partition policy of a level-2 partitioned table is HASH, the partition cannot be deleted using the ALTER TABLE DROP PARTITION statement.