forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit11c2d6f
committed
Parallel Hash Full Join.
Full and right outer joins were not supported in the initialimplementation of Parallel Hash Join because of deadlock hazards (seediscussion). Therefore FULL JOIN inhibited parallelism, as the otherjoin strategies can't do that in parallel either.Add a new PHJ phase PHJ_BATCH_SCAN that scans for unmatched tuples onthe inner side of one batch's hash table. For now, sidestep thedeadlock problem by terminating parallelism there. The last process toarrive at that phase emits the unmatched tuples, while others detach andare free to go and work on other batches, if there are any, butotherwise they finish the join early.That unfairness is considered acceptable for now, because it's betterthan no parallelism at all. The build and probe phases are run inparallel, and the new scan-for-unmatched phase, while serial, is usuallyapplied to the smaller of the two relations and is either limited bysome multiple of work_mem, or it's too big and is partitioned intobatches and then the situation is improved by batch-level parallelism.Author: Melanie Plageman <melanieplageman@gmail.com>Author: Thomas Munro <thomas.munro@gmail.com>Reviewed-by: Thomas Munro <thomas.munro@gmail.com>Discussion:https://postgr.es/m/CA%2BhUKG%2BA6ftXPz4oe92%2Bx8Er%2BxpGZqto70-Q_ERwRaSyA%3DafNg%40mail.gmail.com1 parentca7b3c4 commit11c2d6f
File tree
7 files changed
+323
-48
lines changed- src
- backend
- executor
- optimizer/path
- include/executor
- test/regress
- expected
- sql
7 files changed
+323
-48
lines changedLines changed: 170 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2071 | 2071 |
| |
2072 | 2072 |
| |
2073 | 2073 |
| |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
2074 | 2137 |
| |
2075 | 2138 |
| |
2076 | 2139 |
| |
| |||
2145 | 2208 |
| |
2146 | 2209 |
| |
2147 | 2210 |
| |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
2148 | 2277 |
| |
2149 | 2278 |
| |
2150 | 2279 |
| |
| |||
3088 | 3217 |
| |
3089 | 3218 |
| |
3090 | 3219 |
| |
| 3220 | + | |
3091 | 3221 |
| |
3092 | 3222 |
| |
3093 | 3223 |
| |
| |||
3133 | 3263 |
| |
3134 | 3264 |
| |
3135 | 3265 |
| |
| 3266 | + | |
3136 | 3267 |
| |
3137 | 3268 |
| |
3138 | 3269 |
| |
3139 | 3270 |
| |
3140 | 3271 |
| |
3141 |
| - | |
3142 |
| - | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
3143 | 3306 |
| |
3144 | 3307 |
| |
3145 |
| - | |
3146 |
| - | |
3147 |
| - | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
3148 | 3313 |
| |
3149 | 3314 |
| |
3150 | 3315 |
| |
|
Lines changed: 54 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
| 89 | + | |
89 | 90 |
| |
90 | 91 |
| |
91 | 92 |
| |
| |||
103 | 104 |
| |
104 | 105 |
| |
105 | 106 |
| |
106 |
| - | |
107 |
| - | |
108 |
| - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
109 | 111 |
| |
110 | 112 |
| |
111 | 113 |
| |
| |||
393 | 395 |
| |
394 | 396 |
| |
395 | 397 |
| |
396 |
| - | |
397 |
| - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
398 | 415 |
| |
399 | 416 |
| |
400 | 417 |
| |
| |||
487 | 504 |
| |
488 | 505 |
| |
489 | 506 |
| |
490 |
| - | |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 |
| - | |
495 |
| - | |
496 |
| - | |
497 |
| - | |
498 |
| - | |
499 |
| - | |
500 |
| - | |
501 |
| - | |
502 |
| - | |
503 |
| - | |
504 |
| - | |
505 |
| - | |
506 |
| - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
507 | 513 |
| |
508 |
| - | |
509 | 514 |
| |
510 | 515 |
| |
511 | 516 |
| |
| |||
563 | 568 |
| |
564 | 569 |
| |
565 | 570 |
| |
566 |
| - | |
| 571 | + | |
| 572 | + | |
567 | 573 |
| |
568 | 574 |
| |
569 | 575 |
| |
| |||
966 | 972 |
| |
967 | 973 |
| |
968 | 974 |
| |
| 975 | + | |
| 976 | + | |
969 | 977 |
| |
970 | 978 |
| |
971 | 979 |
| |
| |||
1197 | 1205 |
| |
1198 | 1206 |
| |
1199 | 1207 |
| |
1200 |
| - | |
1201 |
| - | |
1202 |
| - | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1203 | 1211 |
| |
1204 | 1212 |
| |
1205 | 1213 |
| |
| 1214 | + | |
1206 | 1215 |
| |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1207 | 1234 |
| |
1208 | 1235 |
| |
1209 | 1236 |
| |
|
Lines changed: 6 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2193 | 2193 |
| |
2194 | 2194 |
| |
2195 | 2195 |
| |
2196 |
| - | |
2197 |
| - | |
2198 |
| - | |
2199 |
| - | |
2200 | 2196 |
| |
2201 | 2197 |
| |
2202 | 2198 |
| |
2203 |
| - | |
2204 |
| - | |
2205 | 2199 |
| |
2206 | 2200 |
| |
2207 | 2201 |
| |
| |||
2235 | 2229 |
| |
2236 | 2230 |
| |
2237 | 2231 |
| |
2238 |
| - | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
2239 | 2235 |
| |
2240 |
| - | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
2241 | 2239 |
| |
2242 | 2240 |
| |
2243 | 2241 |
| |
|
0 commit comments
Comments
(0)