|
10 | 10 | *
|
11 | 11 | *
|
12 | 12 | * IDENTIFICATION
|
13 |
| - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.155 2003/08/17 19:58:05 tgl Exp $ |
| 13 | + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.156 2003/08/26 22:56:51 tgl Exp $ |
14 | 14 | *
|
15 | 15 | *-------------------------------------------------------------------------
|
16 | 16 | */
|
@@ -944,6 +944,10 @@ create_nestloop_plan(Query *root,
|
944 | 944 | otherclauses = NIL;
|
945 | 945 | }
|
946 | 946 |
|
| 947 | + /* Sort clauses into best execution order */ |
| 948 | + joinclauses = order_qual_clauses(root, joinclauses); |
| 949 | + otherclauses = order_qual_clauses(root, otherclauses); |
| 950 | + |
947 | 951 | join_plan = make_nestloop(tlist,
|
948 | 952 | joinclauses,
|
949 | 953 | otherclauses,
|
@@ -995,6 +999,11 @@ create_mergejoin_plan(Query *root,
|
995 | 999 | mergeclauses = get_switched_clauses(best_path->path_mergeclauses,
|
996 | 1000 | best_path->jpath.outerjoinpath->parent->relids);
|
997 | 1001 |
|
| 1002 | + /* Sort clauses into best execution order */ |
| 1003 | + joinclauses = order_qual_clauses(root, joinclauses); |
| 1004 | + otherclauses = order_qual_clauses(root, otherclauses); |
| 1005 | + mergeclauses = order_qual_clauses(root, mergeclauses); |
| 1006 | + |
998 | 1007 | /*
|
999 | 1008 | * Create explicit sort nodes for the outer and inner join paths if
|
1000 | 1009 | * necessary. The sort cost was already accounted for in the path.
|
@@ -1078,6 +1087,11 @@ create_hashjoin_plan(Query *root,
|
1078 | 1087 | hashclauses = get_switched_clauses(best_path->path_hashclauses,
|
1079 | 1088 | best_path->jpath.outerjoinpath->parent->relids);
|
1080 | 1089 |
|
| 1090 | + /* Sort clauses into best execution order */ |
| 1091 | + joinclauses = order_qual_clauses(root, joinclauses); |
| 1092 | + otherclauses = order_qual_clauses(root, otherclauses); |
| 1093 | + hashclauses = order_qual_clauses(root, hashclauses); |
| 1094 | + |
1081 | 1095 | /*
|
1082 | 1096 | * Extract the inner hash keys (right-hand operands of the
|
1083 | 1097 | * hashclauses) to put in the Hash node.
|
|
0 commit comments