pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brian Choate <brianc@nimblefish.com>
To: pgsql-performance@postgresql.org
Subject: Poor performance of delete by primary key
Date: Tue, 6 Sep 2005 08:04:22 -0700
Message-ID: <2F9239F5E316C54688FDA9814FF045D6EADACC@EXCHANGE.sf.nimblefish.com> (raw)

Hello,

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.

This table does have children through foreign keys, but I am pretty sure that all foreign key constraints in the schema have indexes on their children. 

Sometimes if we do a vacuum right before running the process the delete will go much faster. But then the next time we run the task, even just a few minutes later, the delete takes a long time to run.

We deploy the same application also on Oracle. The schemas are pretty much identical. On similar hardware with actually about 4 to 5 times the data, Oracle does not seem to have the same problem. Not that that really means anything since the internals of Oracle and PostgreSQL are so different, but an interesting fact anyway.

Any ideas on what might be going on?

Thanks,
B.

view thread (8+ messages)  latest in thread

Message-ID: <2F9239F5E316C54688FDA9814FF045D6EADACC@EXCHANGE.sf.nimblefish.com>
Permalink:  ../2F9239F5E316C54688FDA9814FF045D6EADACC@EXCHANGE.sf.nimblefish.com/
Also on:    postgresql.org/message-id/2F9239F5E316C54688FDA9814FF045D6EADACC@EXCHANGE.sf.nimblefish.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: brianc@nimblefish.com
  Subject: Re: Poor performance of delete by primary key
  In-Reply-To: <2F9239F5E316C54688FDA9814FF045D6EADACC@EXCHANGE.sf.nimblefish.com>
  References: <2F9239F5E316C54688FDA9814FF045D6EADACC@EXCHANGE.sf.nimblefish.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox