Use the TRUNCATE TABLE statement to remove all rows from a table.
The TRUNCATE TABLE statement is semantically equivalent to a DELETE FROM statement, see DELETE FROM. However, the TRUNCATE TABLE statement is much more efficient due to relaxed isolation.
During the execution of the TRUNCATE TABLE statement, the defined isolation level is not maintained in concurrent transactions. The effect of removing the rows is seen immediately in all concurrent transactions. Therefore, this statement is recommended for maintenance purposes only.
When the truncated table participates in a referential integrity constraint as a referenced table, the TRUNCATE TABLE statement fails if the referencing table is not empty, regardless of the referential action defined (RESTRICT, CASCADE, and so on). The restriction does not apply if the referencing table is the same as the referenced table (a tree-structured table).
If a collection of interrelated tables is to be truncated, the TRUNCATE TABLE statements should be executed in order, starting with the tables that are not referenced by other tables, up the referencing chain, and finishing with the table that is a referenced table only.