pgsql: Avoid uselessly building a duplicate of the original clause in

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid uselessly building a duplicate of the original clause in
Date: 2007-11-23 19:57:45
Message-ID: 20071123195745.075F37540F0@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Avoid uselessly building a duplicate of the original clause in trivial cases
where the EquivalenceClass machinery is unable to deduce anything more from a
simple "var = const" qual clause. There are probably some more cases where
this could be done, but this seems to take care of most of the added overhead
for simple queries. Per gripe from Guillaume Smet.

In passing, fix a problem that was exposed by this change:
reconsider_outer_join_clause and friends were passing the wrong relids to
build_implied_join_equality, resulting in RestrictInfos with the wrong
required_relids. This mistake was masked in typical cases since the bogus
RestrictInfos would never have escaped from the EquivalenceClass machinery,
but I think there might be corner cases involving "broken" ECs where there
would have been a visible failure even without the new optimization. In any
case the code was certainly not operating as intended.

Modified Files:
--------------
pgsql/src/backend/optimizer/path:
equivclass.c (r1.6 -> r1.7)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/equivclass.c?r1=1.6&r2=1.7)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2007-11-24 00:39:44 pgsql: Change fix_scan_expr() to avoid copying the input node tree in
Previous Message Bruce Momjian 2007-11-23 19:54:39 pgsql: Fix white space in MONEY type code.