X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0D5FA538C9 for ; Tue, 19 Apr 2005 17:45:02 -0300 (ADT) 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 30221-03 for ; Tue, 19 Apr 2005 20:44: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 639EF538C4 for ; Tue, 19 Apr 2005 17:44:50 -0300 (ADT) 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 j3JKinEX025383; Tue, 19 Apr 2005 16:44:49 -0400 (EDT) To: josh@agliodbs.com Cc: "pgsql-perform" Subject: Re: Bad n_distinct estimation; hacks suggested? In-reply-to: <200504191209.05181.josh@agliodbs.com> References: <200504191209.05181.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Tue, 19 Apr 2005 12:09:05 -0700" Date: Tue, 19 Apr 2005 16:44:49 -0400 Message-ID: <25382.1113943489@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/467 X-Sequence-Number: 11864 Josh Berkus writes: > As you can see, n_distinct estimation is off by a factor of 10x and it's > causing query planning problems. Any suggested hacks to improve the > histogram on this? What's the histogram itself look like? (I'd like to see the whole pg_stats row not just part of it ...) There's probably no point in showing the target=1000 version, but maybe target=100 would be informative. regards, tom lane