Re: PATCH: index-only scans with partial indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: index-only scans with partial indexes
Date: 2015-07-10 20:43:22
Message-ID: 26120.1436561002@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> writes:
> currently partial indexes end up not using index only scans in most
> cases, because check_index_only() is overly conservative, as explained
> in this comment:
> ...

> I've done a bunch of tests, and I do see small (hardly noticeable)
> increase in planning time with long list of WHERE clauses, because all
> those need to be checked against the index predicate. Not sure if this
> is what's meant by 'quite expensive' in the comment. Moreover, this was
> more than compensated by the IOS benefits (even with everything in RAM).

> But maybe it's possible to fix that somehow? For example, we're
> certainly doing those checks elsewhere when deciding which clauses need
> to be evaluated at run-time, so maybe we could cache that somehow?

The key problem here is that you're doing those proofs vastly earlier than
before, for indexes that might not get used at all in the final plan.
If you do some tests with multiple partial indexes you will probably see
a bigger planning-time penalty.

Perhaps we should bite the bullet and do it anyway, but I'm pretty
suspicious of any claim that the planning cost is minimal.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2015-07-10 21:05:53 Re: pg_upgrade + Extensions
Previous Message Jim Nasby 2015-07-10 20:42:13 Re: pg_upgrade + Ubuntu