aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/createplan.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-08-26 22:56:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-08-26 22:56:51 +0000
commit73e3edf2e64925a5a012c4155ab453a7a864895a (patch)
tree3f4068e14308bb95a48afe56899850b5ec469da5 /src/backend/optimizer/plan/createplan.c
parent147c16497b772da4ef4d52a1d44014e5792fa56d (diff)
downloadpostgresql-73e3edf2e64925a5a012c4155ab453a7a864895a.tar.gz
postgresql-73e3edf2e64925a5a012c4155ab453a7a864895a.zip
Push subplan clauses to the back in qual lists for join plans, not
only scan plans. Per observation from Rod Taylor.
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
-rw-r--r--src/backend/optimizer/plan/createplan.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 634cfb3a57c..fb5040c94ce 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.155 2003/08/17 19:58:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.156 2003/08/26 22:56:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -944,6 +944,10 @@ create_nestloop_plan(Query *root,
otherclauses = NIL;
}
+ /* Sort clauses into best execution order */
+ joinclauses = order_qual_clauses(root, joinclauses);
+ otherclauses = order_qual_clauses(root, otherclauses);
+
join_plan = make_nestloop(tlist,
joinclauses,
otherclauses,
@@ -995,6 +999,11 @@ create_mergejoin_plan(Query *root,
mergeclauses = get_switched_clauses(best_path->path_mergeclauses,
best_path->jpath.outerjoinpath->parent->relids);
+ /* Sort clauses into best execution order */
+ joinclauses = order_qual_clauses(root, joinclauses);
+ otherclauses = order_qual_clauses(root, otherclauses);
+ mergeclauses = order_qual_clauses(root, mergeclauses);
+
/*
* Create explicit sort nodes for the outer and inner join paths if
* necessary. The sort cost was already accounted for in the path.
@@ -1078,6 +1087,11 @@ create_hashjoin_plan(Query *root,
hashclauses = get_switched_clauses(best_path->path_hashclauses,
best_path->jpath.outerjoinpath->parent->relids);
+ /* Sort clauses into best execution order */
+ joinclauses = order_qual_clauses(root, joinclauses);
+ otherclauses = order_qual_clauses(root, otherclauses);
+ hashclauses = order_qual_clauses(root, hashclauses);
+
/*
* Extract the inner hash keys (right-hand operands of the
* hashclauses) to put in the Hash node.