Re: path toward faster partition pruning

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp
Cc: sulamul(at)gmail(dot)com, david(dot)rowley(at)2ndquadrant(dot)com, robertmhaas(at)gmail(dot)com, dilipbalaut(at)gmail(dot)com, rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com, memissemerson(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: path toward faster partition pruning
Date: 2017-11-10 07:07:01
Message-ID: 20171110.160701.106426656.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

At Fri, 10 Nov 2017 14:44:55 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote in <20171110(dot)144455(dot)117208639(dot)horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>

> > Those two conditions are not orthogonal. Maybe something like
> > following seems more understantable.
> >
> > > if (!constfalse)
> > > {
> > > /* No constraints on the keys, so, return *all* partitions. */
> > > if (nkeys == 0)
> > > return bms_add_range(result, 0, partdesc->nparts - 1);
> > >
> > > result = get_partitions_for_keys(relation, &keys);
> > > }

So, the condition (!constfalse && nkeys == 0) cannot return
there. I'm badly confused by the variable name.

I couldn't find another reasonable structure using the current
classify_p_b_keys(), but could you add a comment like the
following as an example?

+ /*
+ * Ths function processes other than OR expressions and returns
+ * the excluded OR expressions in or_clauses
+ */
> nkeys = classify_partition_bounding_keys(relation, clauses,
> &keys, &constfalse,
> &or_clauses);
> /*
> * Only look up in the partition decriptor if the query provides
> * constraints on the keys at all.
> */
> if (!constfalse)
> {
> if (nkey > 0)
> result = get_partitions_for_keys(relation, &keys);
> else
-+ /* No constraints on the keys, so, all partitions are passed. */
> result = bms_add_range(result, 0, partdesc->nparts - 1);
> }
>
+ /*
+ * We have a partition set for clauses not returned in or_clauses
+ * here. Conjuct the result of each OR clauses.
+ */
> foreach(lc, or_clauses)
> {
> BoolExpr *or = (BoolExpr *) lfirst(lc);
> ListCell *lc1;
> Bitmapset *or_partset = NULL;
>
+ Assert(or_clause(or));

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-11-10 07:12:35 Re: proposal: psql command \graw
Previous Message Pavel Stehule 2017-11-10 06:21:14 Re: proposal: psql command \graw