* try_hashjoin_path * Consider a hash join path; if it appears useful, push it into * the joinrel's pathlist via add_path(). */
| 1100 | * the joinrel's pathlist via add_path(). |
| 1101 | */ |
| 1102 | static void |
| 1103 | try_hashjoin_path(PlannerInfo *root, |
| 1104 | RelOptInfo *joinrel, |
| 1105 | Path *outer_path, |
| 1106 | Path *inner_path, |
| 1107 | List *hashclauses, |
| 1108 | JoinType jointype, |
| 1109 | JoinType orig_jointype, |
| 1110 | JoinPathExtraData *extra) |
| 1111 | { |
| 1112 | Relids required_outer; |
| 1113 | JoinCostWorkspace workspace; |
| 1114 | |
| 1115 | /* |
| 1116 | * Check to see if proposed path is still parameterized, and reject if the |
| 1117 | * parameterization wouldn't be sensible. |
| 1118 | */ |
| 1119 | required_outer = calc_non_nestloop_required_outer(outer_path, |
| 1120 | inner_path); |
| 1121 | if (required_outer && |
| 1122 | !bms_overlap(required_outer, extra->param_source_rels)) |
| 1123 | { |
| 1124 | /* Waste no memory when we reject a path here */ |
| 1125 | bms_free(required_outer); |
| 1126 | return; |
| 1127 | } |
| 1128 | |
| 1129 | /* |
| 1130 | * See comments in try_nestloop_path(). Also note that hashjoin paths |
| 1131 | * never have any output pathkeys, per comments in create_hashjoin_path. |
| 1132 | */ |
| 1133 | initial_cost_hashjoin(root, &workspace, jointype, hashclauses, |
| 1134 | outer_path, inner_path, extra, false); |
| 1135 | |
| 1136 | if (add_path_precheck(joinrel, |
| 1137 | workspace.startup_cost, workspace.total_cost, |
| 1138 | NIL, required_outer)) |
| 1139 | { |
| 1140 | add_path(joinrel, (Path *) |
| 1141 | create_hashjoin_path(root, |
| 1142 | joinrel, |
| 1143 | jointype, |
| 1144 | orig_jointype, |
| 1145 | &workspace, |
| 1146 | extra, |
| 1147 | outer_path, |
| 1148 | inner_path, |
| 1149 | false, /* parallel_hash */ |
| 1150 | extra->restrictlist, |
| 1151 | required_outer, |
| 1152 | extra->redistribution_clauses, |
| 1153 | hashclauses), |
| 1154 | root); |
| 1155 | } |
| 1156 | else |
| 1157 | { |
| 1158 | /* Waste no memory when we reject a path here */ |
| 1159 | bms_free(required_outer); |
no test coverage detected