TRUNCATE
removes all the contents of the table, but keeps the structure of the table intact. Besides data, tables have indexes, constraints, triggers, and partitions for instance.
DROP
drops the tables and the associated metadata, including indexes, constraints, and triggers.
You use TRUNCATE
when you want to reload the table with new data. You use DROP
when you don't want the table anymore.
A third possibility is DELETE
to remove all the rows. Although the end result is the same as TRUNCATE
, In most databases, this logs every row deletion and triggers delete triggers, so it is more expensive than TRUNCATE
.