]> granicus.if.org Git - postgresql/commit
Avoid uselessly building a duplicate of the original clause in trivial cases
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 23 Nov 2007 19:57:44 +0000 (19:57 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 23 Nov 2007 19:57:44 +0000 (19:57 +0000)
commit92c0bf09603bc965816ebb589e28a44dfbb9e8f7
tree35d3ed2b558b9da04e32209b896c4de68f870b5b
parent335d9aff6fd49378daae8f215205aac4cdeb1458
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.
src/backend/optimizer/path/equivclass.c