Re: 7.4 - FK constraint performance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ow <oneway_111(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: 7.4 - FK constraint performance
Date: 2004-02-12 15:54:20
Message-ID: 4559.1076601260@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

ow <oneway_111(at)yahoo(dot)com> writes:
> When I try to delete record, it takes > 3 min.

I think it must be using a seqscan for the foreign key check query.
Could you try this and show the results?

prepare foo(my.dint) as
SELECT 1 FROM ONLY "my"."large" x WHERE "small_id" = $1 FOR UPDATE OF x;

explain analyze execute foo(239);

When I try it I see an indexscan plan, but maybe there's some aspect of
your setup that's causing problems.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2004-02-12 16:02:47 Re: How can I have 2 completely seperated databases in
Previous Message ow 2004-02-12 15:53:51 Re: 7.4 - FK constraint performance

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2004-02-12 16:04:53 Re: 7.4 - FK constraint performance
Previous Message ow 2004-02-12 15:53:51 Re: 7.4 - FK constraint performance