Re: Improving N-Distinct estimation by ANALYZE

Lukas Kahwe Smith <smith@pooteeweet.org>

From: Lukas Smith <smith@pooteeweet.org>
To: Simon Riggs <simon@2ndquadrant.com>
Date: 2006-01-09T10:52:16Z
Lists: pgsql-hackers
Simon Riggs wrote:

> - yes, the random sampling is random - please read the code and comments
> 
> - yes, I would expect the results you get. If you sample 5% of rows and
> each block has on average at least 20 rows, then we should expect the
> majority of blocks to be hit.

and it seems from the benchmark posted to this list that random is 
_very_ expensive (probably because the random reads are spread out so 
well, that we do alot of I/O instead of just logical I/O from some cache)

regards,
Lukas