Hello

related to

https://commitfest.postgresql.org/action/patch_view?id=1130
http://www.postgresql.org/message-id/cabwtf4v9rsjibwe+87pk83mmm7acdrg7sz08rq-4qyme8jv...@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


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

Reply via email to