forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1184611
committed
Performance fix for new anti-join code in nodeMergejoin.c: after finding a
match in antijoin mode, we should advance to next outer tuple not next inner.We know we don't want to return this outer tuple, and there is no point inadvancing over matching inner tuples now, because we'd just have to do itagain if the next outer tuple has the same merge key. This makes a noticeabledifference if there are lots of duplicate keys in both inputs.Similarly, after finding a match in semijoin mode, arrange to advance tothe next outer tuple after returning the current match; or immediately,if it fails the extra quals. The rationale is the same. (This is aperformance bug in existing releases; perhaps worth back-patching? Theplanner tries to avoid using mergejoin with lots of duplicates, so it maynot be a big issue in practice.)Nestloop and hash got this right to start with, but I made some cosmeticadjustments there to make the corresponding bits of logic look more similar.1 parent5b8eb2b commit1184611
File tree
3 files changed
+62
-59
lines changed- src/backend/executor
3 files changed
+62
-59
lines changedLines changed: 24 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
264 | 264 |
| |
265 | 265 |
| |
266 | 266 |
| |
267 |
| - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
268 | 276 |
| |
269 |
| - | |
270 |
| - | |
271 |
| - | |
272 |
| - | |
273 |
| - | |
274 |
| - | |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
| 277 | + | |
279 | 278 |
| |
280 |
| - | |
| 279 | + | |
281 | 280 |
| |
282 |
| - | |
283 |
| - | |
284 |
| - | |
285 |
| - | |
286 |
| - | |
287 |
| - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
288 | 286 |
| |
289 |
| - | |
290 |
| - | |
291 |
| - | |
292 |
| - | |
293 |
| - | |
294 |
| - | |
295 |
| - | |
296 | 287 |
| |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
297 | 295 |
| |
298 | 296 |
| |
299 | 297 |
| |
|
Lines changed: 14 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
757 | 757 |
| |
758 | 758 |
| |
759 | 759 |
| |
760 |
| - | |
761 |
| - | |
762 |
| - | |
763 |
| - | |
764 |
| - | |
765 |
| - | |
766 |
| - | |
767 |
| - | |
768 |
| - | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
769 | 763 |
| |
770 | 764 |
| |
771 | 765 |
| |
| |||
774 | 768 |
| |
775 | 769 |
| |
776 | 770 |
| |
| 771 | + | |
| 772 | + | |
777 | 773 |
| |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
778 | 782 |
| |
779 | 783 |
| |
780 | 784 |
| |
|
Lines changed: 24 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
226 | 226 |
| |
227 | 227 |
| |
228 | 228 |
| |
| 229 | + | |
229 | 230 |
| |
230 |
| - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
231 | 242 |
| |
232 | 243 |
| |
233 |
| - | |
234 |
| - | |
| 244 | + | |
| 245 | + | |
235 | 246 |
| |
236 |
| - | |
237 |
| - | |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 |
| - | |
| 247 | + | |
| 248 | + | |
247 | 249 |
| |
248 |
| - | |
| 250 | + | |
249 | 251 |
| |
250 |
| - | |
| 252 | + | |
251 | 253 |
| |
252 |
| - | |
253 |
| - | |
254 |
| - | |
255 |
| - | |
256 |
| - | |
257 |
| - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
258 | 259 |
| |
259 | 260 |
| |
260 | 261 |
| |
|
0 commit comments
Comments
(0)