Re: PATCH: index-only scans with partial indexes

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: kgrittn(at)ymail(dot)com, simon(at)2ndQuadrant(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PATCH: index-only scans with partial indexes
Date: 2016-02-24 00:13:22
Message-ID: 56CCF5A2.5040702@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 12/06/2015 11:48 PM, Tomas Vondra wrote:
> /*
> * Frequently, there will be no partial indexes, so first check to
> * make sure there's something useful to do here.
> */
> have_partial = false;
> foreach(lc, rel->indexlist)
> {
> IndexOptInfo *index = (IndexOptInfo *) lfirst(lc);
>
> /*
> * index rinfos are the same to baseristrict infos for non-partial
> * indexes
> */
> index->indrinfos = rel->baserestrictinfo;
>
> if (index->indpred == NIL)
> continue; /* ignore non-partial indexes */
>
> if (index->predOK)
> continue; /* don't repeat work if already proven OK */
>
> have_partial = true;
> break;
> }

Attached is a v6 of the patch, which is actually the version submitted
by Kyotaro-san on 2015/10/8 rebased to current master and with two
additional changes.

Firstly, I've removed the "break" from the initial foreach loop in
check_partial_indexes(). As explained in the previous message, I believe
this was a bug in the patch.

Secondly, I've tried to improve the comments to explain a bit better
what the code is doing.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
partial-index-only-scan-v6.patch binary/octet-stream 9.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2016-02-24 01:08:29 Re: The plan for FDW-based sharding
Previous Message Tomas Vondra 2016-02-23 23:30:35 Re: More stable query plans via more predictable column statistics