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 0163432AA12 for ; Mon, 11 Oct 2004 12:04:09 +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 67150-01 for ; Mon, 11 Oct 2004 11:04:01 +0000 (GMT) Received: from pw6tiger.de (pw6tiger.de [217.160.140.116]) by svr1.postgresql.org (Postfix) with SMTP id 4EC6032A900 for ; Mon, 11 Oct 2004 12:04:01 +0100 (BST) Received: (qmail 23471 invoked by uid 505); 11 Oct 2004 11:04:00 -0000 Received: from vygen@gmx.de by planwerk6 by uid 89 with qmail-scanner-1.14 (virus scan: Clear:. Processed in 0.177034 secs); 11 Oct 2004 11:04:00 -0000 Received: from isi-dial-146-203.isionline-dialin.de (HELO ?192.168.1.10?) (vygen@planwerk6.de@195.158.146.203) by pw6tiger.de with SMTP; 11 Oct 2004 11:04:00 -0000 From: Janning Vygen To: "Marc G. Fournier" Subject: Re: How do FKs work? Date: Mon, 11 Oct 2004 13:03:37 +0200 User-Agent: KMail/1.7 Cc: pgsql-sql@postgresql.org References: <20041009145332.D54093@ganymede.hub.org> <200410101424.32846.vygen@gmx.de> <20041010100007.P54093@ganymede.hub.org> In-Reply-To: <20041010100007.P54093@ganymede.hub.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410111303.37986.vygen@gmx.de> 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/75 X-Sequence-Number: 19178 Am Sonntag, 10. Oktober 2004 15:01 schrieb Marc G. Fournier: > On Sun, 10 Oct 2004, Janning Vygen wrote: > > Am Sonntag, 10. Oktober 2004 02:43 schrieb Marc G. Fournier: > >> On Sat, 9 Oct 2004, Tom Lane wrote: > >>> "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. > >> > >> Yup, that was my first thought ... running SELECT's joining the two > >> tables on the FK fields shows indices being used, and fast times ... Could you please show me your schema design regarding those two tables. I had this problem too and it just lacks from an index on the foreign key. janning