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

Re: Poor performance of delete by primary key

From: Matthew Sackman <matthew(at)lshift(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Poor performance of delete by primary key
Date: 2005-09-06 15:43:15
Message-ID: 20050906154315.GL382@pongo.lshift.net (view raw or flat)
Thread:
Lists: pgsql-performance
On Tue, Sep 06, 2005 at 11:32:00AM -0400, Tom Lane wrote:
> "Brian Choate" <brianc(at)nimblefish(dot)com> writes:
> > We are seeing a very strange behavior from postgres. For one of our very =
> > common tasks we have to delete records from a table of around 500,000 =
> > rows. The delete is by id which is the primary key. It seems to be =
> > consistently taking around 10 minutes to preform. This is totally out of =
> > line with the rest of the performance of the database.
> 
> I'll bet this table has foreign-key references from elsewhere, and the
> referencing columns are either not indexed, or not of the same datatype
> as the master column.

Wouldn't setting the FK as deferrable and initially deferred help here
too as then the FK wouldn't be checked until the transaction ended?

Matthew

In response to

pgsql-performance by date

Next:From: Richard HuxtonDate: 2005-09-06 15:51:05
Subject: Re: Poor performance of delete by primary key
Previous:From: Tom LaneDate: 2005-09-06 15:32:00
Subject: Re: Poor performance of delete by primary key

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