DELETE vs TRUNCATE explanation

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: DELETE vs TRUNCATE explanation
Date: 2012-07-11 00:37:24
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-performance


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:

Craig Ringer


Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2012-07-11 03:08:37 Re: Using pg_upgrade on log-shipping standby servers
Previous Message Tatsuo Ishii 2012-07-10 23:23:26 Re: Patch: add conversion from pg_wchar to multibyte

Browse pgsql-performance by date

  From Date Subject
Next Message Daniel Farina 2012-07-11 05:22:27 Re: DELETE vs TRUNCATE explanation
Previous Message Reza Taheri 2012-07-10 19:35:19 Re: The need for clustered indexes to boost TPC-V performance