Re: [HACKERS] Bad n_distinct estimation; hacks suggested? - Mailing list pgsql-performance

From Andrew Dunstan
Subject Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
Date
Msg-id 426EB580.9040606@dunslane.net
Whole thread Raw
In response to Re: [HACKERS] Bad n_distinct estimation; hacks suggested?  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-performance

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

pgsql-performance by date:

Previous
From: "Dave Held"
Date:
Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
Next
From: Mike Rylander
Date:
Subject: Re: Table Partitioning: Will it be supported in Future?