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-22 15:56:14
Message-ID: Pine.LNX.4.33.0211220854250.25220-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Thu, 21 Nov 2002, Josh Berkus wrote:

> Doing several large updates in a single transaction can lower performance if
> the number of updates is sufficient to affect index usability and a VACUUM is
> really needed between them. For example, a series of large data
> transformation statements on a single table or set of related tables should
> have VACCUUM statements between them, thus preventing you from putting them
> in a single transaction.
>
> Example, the series:
> 1. INSERT 10,000 ROWS INTO table_a;
> 2. UPDATE 100,000 ROWS IN table_a WHERE table_b;
> 3. UPDATE 100,000 ROWS IN table_c WHERE table_a;
>
> WIll almost certainly need a VACUUM or even VACUUM FULL table_a after 2),
> requiring you to split the update series into 2 transactions. Otherwise, the
> "where table_a" condition in step 3) will be extremely slow.

Very good point. One that points out the different mind set one needs
when dealing with pgsql.

> > > It can be dangerous though ... in the event of a power outage, for
> > > example, your database could be corrupted and difficult to recover. So
> > > ... "at your own risk".
> >
> > No, the database will not be corrupted, at least not in my experience.
> > however, you MAY lose data from transactions that you thought were
> > committed. I think Tom posted something about this a few days back.
>
> Hmmm ... have you done this? I'd like the performance gain, but I don't want
> to risk my data integrity. I've seen some awful things in databases (such as
> duplicate primary keys) from yanking a power cord repeatedly.

I have, with killall -9 postmaster, on several occasions during testing
under heavy parallel load. I've never had 7.2.x fail because of this.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message scott.marlowe 2002-11-22 15:59:27 Re: Optimizer & boolean syntax
Previous Message Masaru Sugawara 2002-11-22 15:50:50 connectby with schema

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2002-11-23 04:18:22 Re: performance of insert/delete/update
Previous Message Andrew Sullivan 2002-11-22 15:01:52 Re: [ADMIN] H/W RAID 5 on slower disks versus no raid on