Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id D65734774CC for ; Fri, 28 Jun 2002 16:50:46 -0400 (EDT) Mailbox-Line: From rayo@ontko.com Fri Jun 28 16:50:46 2002 Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by postgresql.org (Postfix) with ESMTP id E75D6475DCD for ; Fri, 28 Jun 2002 16:42:01 -0400 (EDT) Received: (from rayo@localhost) by shire.ontko.com (8.9.3/8.9.3/Debian 8.9.3-21) id PAA07634; Fri, 28 Jun 2002 15:42:01 -0500 From: Ray Ontko Message-Id: <200206282042.PAA07634@shire.ontko.com> Subject: Re: Are statistics gathered on function indexes? In-Reply-To: <9389.1025296584@sss.pgh.pa.us> from Tom Lane at "Jun 28, 2002 04:36:24 pm" To: Tom Lane Date: Fri, 28 Jun 2002 15:42:01 -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=-3.5 required=5.0 tests=IN_REP_TO,SUBJ_ENDS_IN_Q_MARK version=2.30 X-Spam-Level: X-Archive-Number: 200206/245 X-Sequence-Number: 4678 Tom, > Ray Ontko writes: > > 1) here's the "bad" stats. > > 2) here's the "good" stats. > > Note that the information really is different. > > Yeah. It seems that the critical difference is the null_frac; if I take > your "bad" values and change null_frac to 0 then I get > reasonable-looking answers, but with null_frac = 0.000333333 I indeed > get bad answers. I suspect null_frac is getting double-counted > somewhere, and depending on just how many nulls ANALYZE happens to find, > you might get pushed over the edge from a small selectivity to zero or > negative selectivity. Will dig further. Does this help? develop=# select count(*) from actor where actor_full_name is not null ; count -------- 433809 (1 row) develop=# select count(*) from actor ; count -------- 433902 (1 row) 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/