X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 42A7432A0B8 for ; Sun, 10 Oct 2004 01:24:04 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91855-09 for ; Sun, 10 Oct 2004 00:23:51 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E26C332A257 for ; Sun, 10 Oct 2004 01:23:54 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i9A0Nr3J006094; Sat, 9 Oct 2004 20:23:53 -0400 (EDT) To: "Marc G. Fournier" Cc: pgsql-sql@postgresql.org Subject: Re: How do FKs work? In-reply-to: <20041009145332.D54093@ganymede.hub.org> References: <20041009145332.D54093@ganymede.hub.org> Comments: In-reply-to "Marc G. Fournier" message dated "Sat, 09 Oct 2004 15:08:51 -0300" Date: Sat, 09 Oct 2004 20:23:53 -0400 Message-ID: <6093.1097367833@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/63 X-Sequence-Number: 19166 "Marc G. Fournier" writes: > Have a table with two FKs on it ... 2 different fields in the table point > to the same field in another table ... > When I do an 'EXPLAIN ANALYZE DELETE FROM table WHERE field = #;', it > never comes back ... or, at lesat, takes a *very* long time ... Do you have indexes on the referencing columns? Are they exactly the same datatype as the referenced column? You can get really awful plans for the FK-checking queries if not. regards, tom lane