DELETE vs TRUNCATE explanation

Craig Ringer <ringerc@ringerc.id.au>

From: Craig Ringer <ringerc@ringerc.id.au>
To: "pgsql-performance@postgresql.org" <pgsql-performance@postgresql.org>
Date: 2012-07-11T00:37:24Z
Lists: pgsql-hackers, pgsql-performance
Hi

After seeing a few discussions here and on Stack Overflow I've put 
together a quick explanation of why "DELETE FROM table;" may be faster 
than "TRUNCATE table" for people doing unit testing on lots of tiny 
tables, people who're doing this so often they care how long it takes.

I'd love it if a few folks who know the guts were to take a look and 
verify its correctness:

http://stackoverflow.com/a/11423886/398670

--
Craig Ringer

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Scan the buffer pool just once, not once per fork, during relation drop.