]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix planner to restore its previous level of intelligence about pushing
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Apr 2009 20:42:28 +0000 (20:42 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Apr 2009 20:42:28 +0000 (20:42 +0000)
commit57af05af0ecd8022c614d271aae4ddea9ba7927e
treedd10101405bbb1fc4b6998119d8adee10fa437f7
parente43d79b78aa1fea89df9580a8b6a0734bed95e5c
Fix planner to restore its previous level of intelligence about pushing
constants through full joins, as in

select * from tenk1 a full join tenk1 b using (unique1)
where unique1 = 42;

which should generate a fairly cheap plan where we apply the constraint
unique1 = 42 in each relation scan.  This had been broken by my patch of
2008-06-27, which is now reverted in favor of a more invasive but hopefully
less incorrect approach.  That patch was meant to prevent incorrect extraction
of OR'd indexclauses from OR conditions above an outer join.  To do that
correctly we need more information than the outerjoin_delay flag can provide,
so add a nullable_relids field to RestrictInfo that records exactly which
relations are nulled by outer joins that are underneath a particular qual
clause.  A side benefit is that we can make the test in create_or_index_quals
more specific: it is now smart enough to extract an OR'd indexclause into the
outer side of an outer join, even though it must not do so in the inner side.
The old coding couldn't distinguish these cases so it could not do either.
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/util/restrictinfo.c
src/include/nodes/relation.h
src/include/optimizer/restrictinfo.h