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 14C6AD1D120 for ; Fri, 13 Feb 2004 01:03:48 +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 84151-07 for ; Thu, 12 Feb 2004 21:03:46 -0400 (AST) Received: from web60801.mail.yahoo.com (web60801.mail.yahoo.com [216.155.196.64]) by svr1.postgresql.org (Postfix) with SMTP id D3E9BD1B4D2 for ; Thu, 12 Feb 2004 21:03:41 -0400 (AST) Message-ID: <20040213010341.95282.qmail@web60801.mail.yahoo.com> Received: from [64.81.205.234] by web60801.mail.yahoo.com via HTTP; Thu, 12 Feb 2004 17:03:41 PST Date: Thu, 12 Feb 2004 17:03:41 -0800 (PST) From: ow Subject: Re: 7.4 - FK constraint performance To: Tom Lane Cc: pgsql-sql@postgresql.org In-Reply-To: <25331.1076632978@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/128 X-Sequence-Number: 16819 --- Tom Lane wrote: > According to this entry, your small_id column only contains the ten > values 1..10, roughly evenly distributed. So why are you probing for > 239?? Let's say we have City (small) and Person (large) tables. A new city was added (mistakenly) with id=239, it does not have any "persons" assigned yet. Hence, we want to remove the wrong "city" record. In any case, one can't remove record from "small" unless there are NO records in "large", RI will not allow it. The initial problem was that I tried to delete a record from "small" and it was taking about 3 min to do that. > The planner is certainly going to estimate a probe for an unspecified > value as retrieving 10% of the table, and under that assumption it's > quite right to use a seqscan. Sounds pretty bad for my case. Any way to avoid the 10% scan? Thanks __________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html