Tom Lane wrote:
> Philip Warner <pjw@rhyme.com.au> writes:
>
>> What I'm suggesting is that if you look at a random sample of index nodes,
>> you should be able to get a statistically valid estimate of the 'clumping'
>> of the data pointed to by the index.
>
>
> And I'm saying that you don't actually have to look at the index in
> order to compute the very same estimate. The only property of the index
> that matters is its sort order; if you assume you know the right sort
> order (and in practice there's usually only one interesting possibility
> for a column) then you can compute the correlation just by looking at
> the table.
This is more true for unique indexes than for non-unique ones unless
our non-unique indexes are smart enough to insert equal index nodes in
table order .
> Andreas correctly points out that this approach doesn't extend very well
> to multi-column or functional indexes, but I'm willing to punt on those
> for the time being ...
----------
Hannu