Change have_join_order_restriction() so that we do not force a clauseless join
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 26 Oct 2007 18:10:58 +0000 (18:10 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 26 Oct 2007 18:10:58 +0000 (18:10 +0000)
commite40ca77fadfd2c9f4e95eea9df15f6136147c4d9
tree7af1723e7f92bf62e92ec5aeaf437820eb0269d9
parent9f3309858f6520d0d7b71d40f563bf08af769259
Change have_join_order_restriction() so that we do not force a clauseless join
if either of the input relations can legally be joined to any other rels using
join clauses.  This avoids uselessly (and expensively) considering a lot of
really stupid join paths when there is a join restriction with a large
footprint, that is, lots of relations inside its LHS or RHS.  My patch of
15-Feb-2007 had been causing the code to consider joining *every* combination
of rels inside such a group, which is exponentially bad :-(.  With this
behavior, clauseless bushy joins will be done if necessary, but they'll be
put off as long as possible.  Per report from Jakub Ouhrabka.

Backpatch to 8.2.  We might someday want to backpatch to 8.1 as well, but 8.1
does not have the problem for OUTER JOIN nests, only for IN-clauses, so it's
not clear anyone's very likely to hit it in practice; and the current patch
doesn't apply cleanly to 8.1.
src/backend/optimizer/README
src/backend/optimizer/path/joinrels.c