Re: review: Non-recursive processing of AND/OR lists

From: Gurjeet Singh <gurjeet(at)singh(dot)im>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: Non-recursive processing of AND/OR lists
Date: 2013-06-18 19:17:20
Message-ID: CABwTF4W+nDfknBS3xfQ8jpSyTyKnJoJshKPiO33X4N9sEkNf7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the review Pavel.

On Tue, Jun 18, 2013 at 3:01 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>wrote:

> Hello
>
> related to
>
> https://commitfest.postgresql.org/action/patch_view?id=1130
>
> http://www.postgresql.org/message-id/CABwTF4V9rsjiBWE+87pK83Mmm7ACdrG7sZ08RQ-4qYMe8jvhbw@mail.gmail.com
>
>
> * motivation: remove recursive procession of AND/OR list (hangs with
> 10062 and more subexpressions)
>
> * patch is short, clean and respect postgresql source code requirements
> * patch was applied cleanly without warnings
> * all regression tests was passed
> * I successfully evaluated expression with 100000 subexpressions
> * there is no significant slowdown
>
> possible improvements
>
> a = (A_Expr*) list_nth(pending, 0);
>
> a = (A_Expr*) linitial(pending);
>
> not well comment
>
> should be -- "If the right branch is also an SAME condition, append it to
> the"
>
> + /*
> + * If the right branch is also an AND condition,
> append it to the
> + * pending list, to be processed later. This
> allows us to walk even
> + * bushy trees, not just left-deep trees.
> + */
> + if (IsA(a->rexpr, A_Expr) &&
> ((A_Expr*)a->rexpr)->kind == root_kind)
> + {
> + pending = lappend(pending, a->rexpr);
> + }
> + else
> + {
> + expr = transformExprRecurse(pstate,
> a->rexpr);
> + expr = coerce_to_boolean(pstate, expr,
> root_kind == AEXPR_AND ?
> "AND" : "OR");
> + exprs = lcons(expr, exprs);
> + }
>
> I don't see any other issues, so after fixing comments this patch is
> ready for commit
>
> Regards
>
> Pavel Stehule
>

--
Gurjeet Singh

http://gurjeet.singh.im/

EnterpriseDB Inc.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-06-18 19:23:38 Re: Git-master regression failure
Previous Message Jeff Janes 2013-06-18 19:14:10 Re: Git-master regression failure