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: 2015-09-30 10:55:40
Message-ID: 560BBFAC.5070209@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

On 09/30/2015 10:29 AM, Kyotaro HORIGUCHI wrote:

> By the way your comment for indexrinfos is as following,
>
>> * 'indexrinfos' is a list of RestrictInfo nodes from the query's WHERE
>> * or JOIN conditions, excluding those implied by the index predicate
>> * (if the index is not partial, the list includes all restriction clauses).
>
> But the v4 patch instead leaves it empty for non-partial
> indexes:) I prefer to follow this comment because looking the
> condition (index->indpred != NIL) for such purpose in
> build_index_paths is somewhat uneasy for me. But I don't insist
> on that if you choose to avoid useless memory and clock
> consumption to construct a list which is not so meaningful for
> non-partial indexes (it is almost all cases).

Good point. I think we may simply point indexrinfos to the existing list
of restrictions in that case - we don't need to copy it. So no
additional memory / CPU consumption, and it should make the code working
with it a bit simpler.

>
> The following comment in match_clause_to_index does not need to be a
> 'XXX' comment. What made you to feel to do so? (I rather feel that it
> is not necessary at all.)

I agree that it may not be really necessary. I added the comment because
initially I've made the check inside the for loop and then spent some
time investigating why it's not working as expected.

>
>> * XXX We must do this before trying to match the index to index
>> * columns, because the index predicates may use columns not
>> * used in the index itself.
>
> Anyway some description on rclauses should be added in the
> comment for match_clause_to_index, instead of the comments
> currently added *within* the function.

OK, will do.

kind regards

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2015-09-30 11:11:20 Re: Additional role attributes && superuser review
Previous Message Etsuro Fujita 2015-09-30 09:14:07 Re: Foreign join pushdown vs EvalPlanQual