Re: DELETE vs TRUNCATE explanation - Mailing list pgsql-performance

From Matthew Woodcraft
Subject Re: DELETE vs TRUNCATE explanation
Date
Msg-id 20120711181037.GF11608@golux.woodcraft.me.uk
Whole thread Raw
In response to Re: DELETE vs TRUNCATE explanation  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: DELETE vs TRUNCATE explanation
List pgsql-performance
Tom Lane wrote:
> (3) The performance of the truncation itself should not be viewed in
> isolation; subsequent behavior also needs to be considered.  An example
> of possible degradation is that index bloat would no longer be
> guaranteed to be cleaned up over a series of repeated truncations.
> (You might argue that if the table is small then the indexes couldn't
> be very bloated, but I don't think that holds up over a long series.)
>
> IOW, I think it's fine as-is.  I'd certainly wish to see many more
> than one complainant before we expend effort in this area.

I think a documentation change would be worthwhile.

At the moment the TRUNCATE page says, with no caveats, that it is faster than
unqualified DELETE.

It surprised me to find that this wasn't true (with 7.2, again with small
tables in a testsuite), and evidently it's still surprising people today.

-M-

pgsql-performance by date:

Previous
From: "Midge Brown"
Date:
Subject: Re: moving tables
Next
From: Craig James
Date:
Subject: Re: DELETE vs TRUNCATE explanation