X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AD393D1B4EA for ; Tue, 23 Sep 2003 20:27:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 45340-02 for ; Tue, 23 Sep 2003 17:27:05 -0300 (ADT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id 388C1D1B52A for ; Tue, 23 Sep 2003 17:27:03 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.6) with SMTP id h8NKR25f016771; Tue, 23 Sep 2003 15:27:05 -0500 Reply-To: From: "Nick Fankhauser" To: "Tom Lane" Cc: "pgsql-admin" Subject: Re: Problem with n_distinct being consistently inaccurate. Date: Tue, 23 Sep 2003 15:26:18 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal In-Reply-To: <22043.1064347653@sss.pgh.pa.us> X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/365 X-Sequence-Number: 10453 > It certainly should be the case. starelid matches to pg_class.oid and > staattnum matches to pg_attribute.attnum. My problem was that I was looking up "event_date_time" in pg_class.relname (and finding it), but the oid matched nothing. when I looked for 'event' in pg_class & 'event_date_time' in pg_attribute, everything became clear. So... I updated stadistinct to the actual value of 92,000 as you suggested and as you predicted, it did not change the plan a bit. I guess I'll look elsewhere for ways to optimize this query. Thanks! -Nick