Re: Setting Statistics on Functional Indexes

From: Claudio Freire <klaussfreire(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: sthomas(at)optionshouse(dot)com, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Setting Statistics on Functional Indexes
Date: 2012-10-26 21:19:05
Message-ID: CAGTBQpbDZw3CVE9mgc_tS3a_ovjjg5YKnHQ=XrM89JNbaA9PvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Oct 26, 2012 at 6:08 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2012-10-26 22:01:38 Re: Setting Statistics on Functional Indexes
Previous Message Tom Lane 2012-10-26 21:08:18 Re: Setting Statistics on Functional Indexes