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 C7B0553583; Tue, 26 Apr 2005 18:42:01 -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 27059-01; Tue, 26 Apr 2005 21:41:50 +0000 (GMT) Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) by svr1.postgresql.org (Postfix) with ESMTP id 6CBC353218; Tue, 26 Apr 2005 18:41:49 -0300 (ADT) Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com [24.211.165.134]) (authenticated (0 bits)) by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j3QKqkA23724; Tue, 26 Apr 2005 15:52:46 -0500 Message-ID: <426EB580.9040606@dunslane.net> Date: Tue, 26 Apr 2005 17:41:20 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050417 Fedora/1.7.7-1.3.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Simon Riggs Cc: Tom Lane , josh@agliodbs.com, Greg Stark , Marko Ristola , pgsql-perform , pgsql-hackers@postgresql.org Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested? References: <200504191209.05181.josh@agliodbs.com> <200504221336.08325.josh@agliodbs.com> <8764ydapky.fsf@stark.xeocode.com> <200504231639.11897.josh@agliodbs.com> <25382.1114318139@sss.pgh.pa.us> <1114547498.21529.349.camel@localhost.localdomain> In-Reply-To: <1114547498.21529.349.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/716 X-Sequence-Number: 12113 Simon Riggs wrote: >The comment > * Every value in the sample appeared more than once. Assume > * the column has just these values. >doesn't seem to apply when using larger samples, as Josh is using. > >Looking at Josh's application it does seem likely that when taking a >sample, all site visitors clicked more than once during their session, >especially if they include home page, adverts, images etc for each page. > >Could it be that we have overlooked this simple explanation and that the >Haas and Stokes equation is actually quite good, but just not being >applied? > > > > No, it is being aplied. If every value in the sample appears more than once, then f1 in the formula is 0, and the result is then just d, the number of distinct values in the sample. cheers andrew