Re: Slow deletes in 8.1 when FKs are involved

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Will Reese <wreese(at)rackspace(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow deletes in 8.1 when FKs are involved
Date: 2006-04-24 03:32:39
Message-ID: 20018.1145849559@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Will Reese <wreese(at)rackspace(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Brendan Duddridge 2006-04-24 04:46:35 Re: Recovery will take 10 hours
Previous Message Will Reese 2006-04-24 02:41:14 Slow deletes in 8.1 when FKs are involved