Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Uq8xD-0004gK-S6 for pgsql-performance@arkaria.postgresql.org; Fri, 21 Jun 2013 21:33:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Uq8xD-0006r6-33 for pgsql-performance@arkaria.postgresql.org; Fri, 21 Jun 2013 21:33:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Uq8xC-0006qy-31 for pgsql-performance@postgresql.org; Fri, 21 Jun 2013 21:33:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Uq8x4-0008C2-Gv for pgsql-performance@postgresql.org; Fri, 21 Jun 2013 21:33:09 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r5LLWwc3025931; Fri, 21 Jun 2013 17:32:58 -0400 (EDT) From: Tom Lane To: Josh Berkus cc: "pgsql-performance@postgresql.org" Subject: Re: Weird, bad 0.5% selectivity estimate for a column equal to itself In-reply-to: <51C4AEE5.8040704@agliodbs.com> References: <51C4AEE5.8040704@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Fri, 21 Jun 2013 12:52:05 -0700" Date: Fri, 21 Jun 2013 17:32:58 -0400 Message-ID: <25930.1371850378@sss.pgh.pa.us> X-Pg-Spam-Score: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Josh Berkus writes: > I'm getting something really odd in 9.2.4, where the planner estimates > that the selectivity of a column equal to itself is always exactly 0.5% > (i.e. 0.005X). I can't figure out where this constant is coming from, > or why it's being applied. See DEFAULT_EQ_SEL. But why exactly do you care? Surely it's a stupid query and you should fix it. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance