Re: Setting Statistics on Functional Indexes - Mailing list pgsql-performance

From Claudio Freire
Subject Re: Setting Statistics on Functional Indexes
Date
Msg-id CAGTBQpbDZw3CVE9mgc_tS3a_ovjjg5YKnHQ=XrM89JNbaA9PvQ@mail.gmail.com
Whole thread Raw
In response to Re: Setting Statistics on Functional Indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Setting Statistics on Functional Indexes
List pgsql-performance
On Fri, Oct 26, 2012 at 6:08 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Interestingly, this is a case where the get_actual_variable_range patch
> (commit 40608e7f, which appeared in 9.0) makes the results worse.
> Before that, there was a (very arbitrary) lower bound on what we'd
> believe as the selectivity of a >= condition, but now, when we know the
> actual upper limit of the variable, we don't clamp the result that way.
> I think the clamp must have been saving you in your previous version,
> because it more-or-less-accidentally accounted for the end value not
> being unique.

IIRC, that patch was performing an index query (index_last) to get the
real largest value, right?

How many duplicates would you think the planner would require to
choose another (better) plan?

Because once you've accessed that last index page, it would be rather
trivial finding out how many duplicate tids are in that page and, with
a small CPU cost (no disk access if you don't query other index pages)
you could verify the assumption of near-uniqueness.


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Setting Statistics on Functional Indexes
Next
From: Tom Lane
Date:
Subject: Re: Setting Statistics on Functional Indexes