X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 04263D1D767 for ; Thu, 12 Feb 2004 15:54:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 60069-10 for ; Thu, 12 Feb 2004 11:54:22 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 8FF43D1D66C for ; Thu, 12 Feb 2004 11:54:16 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i1CFsLOa004560; Thu, 12 Feb 2004 10:54:21 -0500 (EST) To: ow Cc: pgsql-sql@postgresql.org Subject: Re: 7.4 - FK constraint performance In-reply-to: <20040212000610.13913.qmail@web60806.mail.yahoo.com> References: <20040212000610.13913.qmail@web60806.mail.yahoo.com> Comments: In-reply-to ow message dated "Wed, 11 Feb 2004 16:06:10 -0800" Date: Thu, 12 Feb 2004 10:54:20 -0500 Message-ID: <4559.1076601260@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/117 X-Sequence-Number: 16808 ow 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