Skip site navigation (1) Skip section navigation (2)

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
Message-ID: 4FFCCAC4.4030503@ringerc.id.au (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

Responses

pgsql-performance by date

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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group