Switch the planner over to treating qualifications of a JOIN_SEMI join as
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 22 Nov 2008 22:47:06 +0000 (22:47 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 22 Nov 2008 22:47:06 +0000 (22:47 +0000)
commit10082916d06f701b8e73c33cba2cdb5e98b72fed
tree2962ae0c923ab4103b9474ae168cf5d0bcd4641e
parent59a03aed92adbc5cfa5017785b644de606cb87f2
Switch the planner over to treating qualifications of a JOIN_SEMI join as
though it is an inner rather than outer join type.  This essentially means
that we don't bother to separate "pushed down" qual conditions from actual
join quals at a semijoin plan node; which is okay because the restrictions of
SQL syntax make it impossible to have a pushed-down qual that references the
inner side of a semijoin.  This allows noticeably better optimization of
IN/EXISTS cases than we had before, since the equivalence-class machinery can
now use those quals.  Also fix a couple of other mistakes that had essentially
disabled the ability to unique-ify the inner relation and then join it to just
a subset of the left-hand relations.  An example case using the regression
database is

select * from tenk1 a, tenk1 b
where (a.unique1,b.unique2) in (select unique1,unique2 from tenk1 c);

which is planned reasonably well by 8.3 and earlier but had been forcing a
cartesian join of a/b in CVS HEAD.
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/plan/initsplan.c
src/include/nodes/nodes.h