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 0B3EAD1B897 for ; Fri, 13 Feb 2004 00:43:01 +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 78523-10 for ; Thu, 12 Feb 2004 20:43:00 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 86803D1B557 for ; Thu, 12 Feb 2004 20:42:55 -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 i1D0gw0l025332; Thu, 12 Feb 2004 19:42:58 -0500 (EST) To: ow Cc: pgsql-sql@postgresql.org Subject: Re: 7.4 - FK constraint performance In-reply-to: <20040213002548.19523.qmail@web60808.mail.yahoo.com> References: <20040213002548.19523.qmail@web60808.mail.yahoo.com> Comments: In-reply-to ow message dated "Thu, 12 Feb 2004 16:25:48 -0800" Date: Thu, 12 Feb 2004 19:42:58 -0500 Message-ID: <25331.1076632978@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/122 X-Sequence-Number: 16813 ow writes: > schemaname tablename attname null_frac avg_width n_distinct most_common_vals > most_common_freqs histogram_bounds correlation > my large small_id 0 4 10 {7,3,5,1,4,2,8,10,6,9} > {0.108667,0.105,0.104333,0.101333,0.100667,0.0983333,0.0983333,0.0983333,0.094,0.091} > 0.0597573 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?? 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. If this estimate is not right, perhaps you could give us a more accurate view of the column statistics? regards, tom lane