postgres.git / summary / log / commit / refs
commit 72fb03b8c87acfb4c5be253f086170b8e20d7101
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed Oct 24 20:54:33 2007 +0000
First released in: 8.3.0, 8.2.6
Fix an error in make_outerjoininfo introduced by my patch of 30-Aug: the code
neglected to test whether an outer join's join-condition actually refers to
the lower outer join it is looking at. (The comment correctly described what
was supposed to happen, but the code didn't do it...) This often resulted in
adding an unnecessary constraint on the join order of the two outer joins,
which was bad enough. However, it also seems to expose a performance
problem in an older patch (from 15-Feb): once we've decided that there is a
join ordering constraint, we will start trying clauseless joins between every
combination of rels within the constraint, which pointlessly eats up lots of
time and space if there are numerous rels below the outer join. That probably
needs to be revisited :-(. Per gripe from Jakub Ouhrabka.
src/backend/optimizer/plan/initsplan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index a22fa102905..322eff45454 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.123.2.7 2007/10/04 20:44:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.123.2.8 2007/10/24 20:54:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -625,6 +625,7 @@ make_outerjoininfo(PlannerInfo *root,
* rel in the lower OJ's min_righthand, not its whole syn_righthand.
*/
if (bms_overlap(left_rels, otherinfo->syn_righthand) &&
+ bms_overlap(clause_relids, otherinfo->syn_righthand) &&
!bms_overlap(strict_relids, otherinfo->min_righthand))
{
min_lefthand = bms_add_members(min_lefthand,
[parent: 9632b06ec711]