postgres table truncate - ghdrako/doc_snipets GitHub Wiki
- Unlike DELETE operations that leave "dead" rows requiring VACUUM operations, TRUNCATE immediately reclaims disk space by essentially creating new, empty data files and can reset identity sequences.
- Despite its efficiency, TRUNCATE is fully transactional in PostgreSQL, meaning it can be rolled back if executed within a transaction block. That is unusual for a DDL command and is different compared to what happens in MySQL and Oracle when using TRUNCATE.
- don't fires
ON DELETE
triggers
Truncate Multiple Tables
TRUNCATE TABLE table1_name, table2_name;
Truncate table referenced by a foreign key
TRUNCATE TABLE orders CASCADE;