Re: DELETE vs TRUNCATE explanation

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Daniel Farina <daniel(at)heroku(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: DELETE vs TRUNCATE explanation
Date: 2012-07-12 19:15:15
Message-ID: CAMkU=1ydaypgAeZxyaMc=KhJJw5riGMBiLpvSqOO42=qArRZmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Wed, Jul 11, 2012 at 3:51 PM, Daniel Farina <daniel(at)heroku(dot)com> wrote:
>
> Nope. I don't. But an exact crossover is a level of precision I don't
> really need, because here are where things stand on a completely
> unremarkable test suite on the closest project to me that meets the
> "regular web-app" profile case:
>
> With en-masse DELETE:
> rake 41.89s user 3.08s system 76% cpu 58.629 total
>
> With TRUNCATE:
> rake 49.86s user 2.93s system 5% cpu 15:17.88 total
>
> 15x slower. This is a Macbook Air with full disk encryption and SSD
> disk with fsync off, e.g. a very typical developer configuration.

What is shared_buffers?

> This is a rather small schema -- probably a half a dozen tables, and
> probably about a dozen indexes. This application is entirely
> unremarkable in its test-database workload: it wants to load a few
> records, do a few things, and then clear those handful of records.

How many rounds of truncation does one rake do? I.e. how many
truncations are occurring over the course of that 1 minute or 15
minutes?

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-07-12 20:30:14 Re: WIP Patch: Selective binary conversion of CSV file foreign tables
Previous Message Bruce Momjian 2012-07-12 18:37:58 Re: WIP pgindent replacement

Browse pgsql-performance by date

  From Date Subject
Next Message Harold A. Giménez 2012-07-12 23:21:13 Re: DELETE vs TRUNCATE explanation
Previous Message Jeff Janes 2012-07-12 18:53:35 Re: how could select id=xx so slow?