Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id DCE5F4773EB for ; Fri, 28 Jun 2002 17:25:40 -0400 (EDT) Mailbox-Line: From rayo@ontko.com Fri Jun 28 17:25:40 2002 Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by postgresql.org (Postfix) with ESMTP id 6D090477568 for ; Fri, 28 Jun 2002 17:03:54 -0400 (EDT) Received: (from rayo@localhost) by shire.ontko.com (8.9.3/8.9.3/Debian 8.9.3-21) id QAA07922; Fri, 28 Jun 2002 16:03:55 -0500 From: Ray Ontko Message-Id: <200206282103.QAA07922@shire.ontko.com> Subject: Re: Are statistics gathered on function indexes? In-Reply-To: <9555.1025297447@sss.pgh.pa.us> from Tom Lane at "Jun 28, 2002 04:50:47 pm" To: Tom Lane Date: Fri, 28 Jun 2002 16:03:55 -0500 (EST) Cc: Ray Ontko , pgsql-admin@postgresql.org X-Mailer: ELM [version 2.4ME+ PL66 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-2.4 required=5.0 tests=IN_REP_TO,SUBJ_ENDS_IN_Q_MARK,DOUBLE_CAPSWORD version=2.30 X-Spam-Level: X-Archive-Number: 200206/247 X-Sequence-Number: 4680 Tom, > Ray Ontko writes: > > Does this help? > > Well, it says that ANALYZE is not doing anything wrong ;-). > > The true null_frac given those numbers is 1.0 - 433809.0/433902.0 > or about 0.000214. In the default ANALYZE sample size (3000 rows) > the statistical expectation would be 0.643 NULLs, so most of the > time ANALYZE is going to find 1 NULL, sometimes no NULLs, and rarely > more than 1 NULL. Most of the time you'll get null_frac = 1/3000 = > 0.000333333, sometimes 0, etc. > > The stats themselves look fine to me; I think there must be a > mathematical error in what selfuncs.c is doing with them. > Still looking to find it... Well, that explains the non-determinism, I guess. It seems odd that if we aren't doing any updates to the data that analyze would give us different stats. How does analyze pick the 3000 rows it gets back, and should this vary from run to run if we aren't changing the table? Ray ---------------------------------------------------------------------- Ray Ontko rayo@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788 Ray Ontko & Co. Software Consulting Services http://www.ontko.com/