Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 5AE454774A0 for ; Fri, 28 Jun 2002 16:50:35 -0400 (EDT) Mailbox-Line: From tgl@sss.pgh.pa.us Fri Jun 28 16:50:35 2002 Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id CB48A475E86 for ; Fri, 28 Jun 2002 16:36:23 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g5SKaOD09392; Fri, 28 Jun 2002 16:36:24 -0400 (EDT) To: Ray Ontko Cc: pgsql-admin@postgresql.org Subject: Re: Are statistics gathered on function indexes? In-reply-to: <200206281943.OAA06865@shire.ontko.com> References: <200206281943.OAA06865@shire.ontko.com> Comments: In-reply-to Ray Ontko message dated "Fri, 28 Jun 2002 14:43:11 -0500" Date: Fri, 28 Jun 2002 16:36:24 -0400 Message-ID: <9389.1025296584@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-5.4 required=5.0 tests=IN_REP_TO,X_NOT_PRESENT,SUBJ_ENDS_IN_Q_MARK version=2.30 X-Spam-Level: X-Archive-Number: 200206/244 X-Sequence-Number: 4677 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. regards, tom lane