Skip to content
UniCircle
EasyConceptualDDL and DML

DELETE vs TRUNCATE vs DROP

Question PG-SQL-007

Compare DELETE, TRUNCATE and DROP TABLE in PostgreSQL.

Show the explanation
DELETETRUNCATEDROP TABLE
Removeschosen rows (WHERE) or allall rowsthe table itself (structure, indexes, data)
Speed on big tablesslow — row by rowvery fastfast
Row triggersfiredo not fire (statement triggers do)—
Spacefreed later by VACUUMfreed immediatelyfreed immediately
Identity resetnooptional: RESTART IDENTITY—
Rollbackyesyes in PostgreSQL (inside a transaction)yes in PostgreSQL
SQL
delete from sessions where last_seen < now() - interval '30 days';
truncate table staging_import restart identity;
drop table if exists old_reports;

Two PostgreSQL-specific points impress interviewers: DDL is transactional, so TRUNCATE and DROP can be rolled back inside BEGIN … ROLLBACK (unlike in some other databases); and TRUNCATE refuses to empty a table referenced by foreign keys unless you add CASCADE.

Original UniCircle question. Last reviewed 22 Oct 2026.