
Truncate vs. Delete: Efficiently Clearing Data from a Postgres Table - mgartner
https://lob.com/blog/truncate-vs-delete-efficiently-clearing-data-from-a-postgres-table
======
protomyth
Wow, that is the exact opposite of Sybase (and I suspect MSSQL). Also, I seem
to remember that Truncate couldn't be used inside a transaction in Sybase as
it was basically a big deallocate that couldn't be reversed.

This is one of those commands that shows why you should really review the
database's own documentation on common commands. They really don't all work
the same. SQL remains a standard where there is a second level of knowledge
springing from the database engines.

------
adeel_siddiqui
Good point. If you are doing this, you also need a good autovacuuming strategy
on your pg database. Depending on the size of the tables and the frequency of
DELETEs, not vacuuming regularly could potentially cause problems like bloated
size on disk, slow queries, etc.

~~~
mgartner
You're totally right. In our case, our test infrastructure spins up a new
Postgres container for every build. Because it's not a long-running database,
bloat is not a concern.

------
shearnie
Yeah MSSQL is the opposite in massive orders of magnitude

