Re: performance problems on Delete

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-admin(at)postgresql(dot)org>,<silvio(dot)brandani(at)tech(dot)sdb(dot)it>
Subject: Re: performance problems on Delete
Date: 2010-08-02 12:56:30
Message-ID: 4C567A2E0200002500033FF1@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2010-08-02 14:04:01 Re: Statistics Collector not collecting server activities
Previous Message Silvio Brandani 2010-08-02 12:34:53 performance problems on Delete