Re: [HACKERS] path toward faster partition pruning - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: [HACKERS] path toward faster partition pruning
Date
Msg-id 20171110.160701.106426656.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: [HACKERS] path toward faster partition pruning  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
List pgsql-hackers
Hello,

At Fri, 10 Nov 2017 14:44:55 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote in
<20171110.144455.117208639.horiguchi.kyotaro@lab.ntt.co.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



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] proposal: psql command \graw
Next
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] proposal: psql command \graw