pgsql: Improve the planner's simplification of NOT constructs.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve the planner's simplification of NOT constructs.
Date: 2010-10-11 03:20:55
Message-ID: E1P58wZ-0000XT-3q@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve the planner's simplification of NOT constructs.

This patch merges the responsibility for NOT-flattening into
eval_const_expressions' processing. It wasn't done that way originally
because prepqual.c is far older than eval_const_expressions. But putting
this work into eval_const_expressions saves one pass over the qual trees,
and in fact saves even more than that because we can exploit the knowledge
that the subexpressions have already been recursively simplified. Doing it
this way also lets us do it uniformly over all expressions, whereas
prepqual.c formerly just did it at top level to save cycles. That should
improve the planner's ability to recognize logically-equivalent constructs.

While at it, also add the ability to fold a NOT into BooleanTest and
NullTest constructs (the latter only for the scalar-datatype case).

Per discussion of bug #5702.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=220e45bf325b061b8dbd7451f87cedc07da61706

Modified Files
--------------
src/backend/optimizer/prep/prepqual.c | 375 +++++++++++++++++++--------------
src/backend/optimizer/util/clauses.c | 42 ++---
src/include/optimizer/prep.h | 1 +
3 files changed, 237 insertions(+), 181 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-10-11 23:05:52 pgsql: Fix assorted bugs in GIN's WAL replay logic.
Previous Message Hiroshi Saito 2010-10-11 00:04:40 psqlodbc - psqlodbc: Fixed lib of ver9.0 path.