Re: performance of insert/delete/update

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Wei Weng <wweng(at)kencast(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: performance of insert/delete/update
Date: 2002-11-25 16:31:20
Message-ID: Pine.LNX.4.33.0211250929090.7632-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Fri, 22 Nov 2002, Josh Berkus wrote:

> Scott,
>
> > > > The absolutely most important thing to do to speed up inserts and
> > > > updates
> > > > is to squeeze as many as you can into one transaction.
>
> I was discussing this on IRC, and nobody could verify this assertion.
> Do you have an example of bunlding multiple writes into a transaction
> giving a performance gain?

Yes, my own experience.

It's quite easy to test if you have a database with a large table to play
with, use pg_dump to dump a table with the -d switch (makes the dump use
insert statements.) Then, make two versions of the dump, one which has a
begin;end; pair around all the inserts and one that doesn't, then use psql
-e to restore both dumps. The difference is HUGE. Around 10 to 20 times
faster with the begin end pairs.

I'd think that anyone who's used postgresql for more than a few months
could corroborate my experience.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ulrich Neumann 2002-11-25 17:37:38 Native Win32 sources
Previous Message Marc G. Fournier 2002-11-25 16:19:23 RC2 Packaged in Preparation for a Wednesday Release ...

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2002-11-25 22:33:07 Re: performance of insert/delete/update
Previous Message Tom Lane 2002-11-23 21:41:37 Re: performance of insert/delete/update