pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: pgsql-admin@postgresql.org
To: silvio.brandani@tech.sdb.it
Subject: Re: performance problems on Delete
Date: Mon, 02 Aug 2010 07:56:30 -0500
Message-ID: <4C567A2E0200002500033FF1@gw.wicourts.gov> (raw)

Silvio Brandani  wrote:
 
> we have a performance issue on deleting data from a table.
>
> the delete is on the index key so should be very fast but the table
> have 13 contraints of type foreign keys and the slowness seems due
> to all the works done with the constraint.
> Trying to drop the constraint and execute the delete the result is
> immediate.
 
The usual reason for this is that you don't have indexes on the
referencing columns, so to check whether the delete is OK it has to
scan the related tables.  Think about what rows need to be checked to
determine whether the delete is allowed and index the columns which
will allow fast access to them.
 
-Kevin



view thread (3+ messages)  latest in thread

Message-ID: <4C567A2E0200002500033FF1@gw.wicourts.gov>
Permalink:  ../4C567A2E0200002500033FF1@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4C567A2E0200002500033FF1@gw.wicourts.gov

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, silvio.brandani@tech.sdb.it
  Subject: Re: performance problems on Delete
  In-Reply-To: <4C567A2E0200002500033FF1@gw.wicourts.gov>

* 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