Other Resources
Postgres as a Service
Deploy a Managed Postgres Cluster in Minutes! Enterprise-ready and Oracle compatible.
![]() |
![]() |
![]() |
13 Table Partitioning : 13.3 Oracle Compatible Partitioning Commands : 13.3.13 ALTER TABLE… TRUNCATE PARTITION
13.3.13 ALTER TABLE… TRUNCATE PARTITIONUse the ALTER TABLE… TRUNCATE PARTITION command to remove the data from the specified partition, leaving the partition structure intact. The syntax is:Use the ALTER TABLE… TRUNCATE PARTITION command to remove the data from the specified partition, leaving the partition structure intact. When you truncate a partition, any subpartitions of that partition are also truncated.ALTER TABLE… TRUNCATE PARTITION will not cause ON DELETE triggers that might exist for the table to fire, but it will fire ON TRUNCATE triggers. If an ON TRUNCATE trigger is defined for the partition, all BEFORE TRUNCATE triggers are fired before any truncation happens, and all AFTER TRUNCATE triggers are fired after the last truncation occurs.DROP STORAGE and REUSE STORAGE are included for compatibility only; the clauses are parsed and ignored.13.3.13.1 Example - Emptying a PartitionThe example that follows removes the data from a partition of the sales table. Use the following command to create the sales table:Populate the sales table with the command:Querying the sales table shows that the partitions are populated with data:To delete the contents of the americas partition, invoke the following command:While the rows have been removed, the structure of the americas partition is still intact:
13 Table Partitioning : 13.3 Oracle Compatible Partitioning Commands : 13.3.13 ALTER TABLE… TRUNCATE PARTITION
![]() |
![]() |
![]() |