pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: DELETE vs TRUNCATE explanation
Date: Wed, 11 Jul 2012 08:37:24 +0800
Message-ID: <4FFCCAC4.4030503@ringerc.id.au> (raw)

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



view thread (46+ messages)  latest in thread

Message-ID: <4FFCCAC4.4030503@ringerc.id.au>
Permalink:  ../4FFCCAC4.4030503@ringerc.id.au/
Also on:    postgresql.org/message-id/4FFCCAC4.4030503@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: ringerc@ringerc.id.au
  Subject: Re: DELETE vs TRUNCATE explanation
  In-Reply-To: <4FFCCAC4.4030503@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox