Re: 7.4 - FK constraint performance - Mailing list pgsql-sql

From Tom Lane
Subject Re: 7.4 - FK constraint performance
Date
Msg-id 4559.1076601260@sss.pgh.pa.us
Whole thread Raw
In response to 7.4 - FK constraint performance  (ow <oneway_111@yahoo.com>)
Responses Re: 7.4 - FK constraint performance  (ow <oneway_111@yahoo.com>)
List pgsql-sql
ow <oneway_111@yahoo.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


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: 7.4 - FK constraint performance
Next
From: ow
Date:
Subject: Re: 7.4 - FK constraint performance