Re: Slow deletes in 8.1 when FKs are involved - Mailing list pgsql-performance

From Tom Lane
Subject Re: Slow deletes in 8.1 when FKs are involved
Date
Msg-id 20018.1145849559@sss.pgh.pa.us
Whole thread Raw
In response to Slow deletes in 8.1 when FKs are involved  (Will Reese <wreese@rackspace.com>)
Responses Re: Slow deletes in 8.1 when FKs are involved
List pgsql-performance
Will Reese <wreese@rackspace.com> writes:
> ... Both servers have identical postgresql.conf settings and were
> restored from the same 7.4 backup. Almost everything is faster on the
> 8.1 server (mostly due to hardware), except one thing...deletes from
> tables with many foreign keys pointing to them.

I think it's unquestionable that you have a bad FK plan in use on the
8.1 server.  Double check that you have suitable indexes on the
referencing (not referenced) columns, that you've ANALYZEd all the
tables involved, and that you've started a fresh psql session (remember
the backend tends to cache FK plans for the life of the connection).

It might help to EXPLAIN ANALYZE one of the slow deletes --- 8.1 will
break out the time spent in FK triggers, which would let you see which
one(s) are the culprit.

            regards, tom lane

pgsql-performance by date:

Previous
From: Brendan Duddridge
Date:
Subject: Re: Recovery will take 10 hours
Next
From: Matteo Beccati
Date:
Subject: Re: Inactive memory Grows unlimited