- Notifications
You must be signed in to change notification settings - Fork5
Commit691b8d5
committed
Allow for parallel execution whenever ExecutorRun() is done only once.
Previously, it was unsafe to execute a plan in parallel ifExecutorRun() might be called with a non-zero row count. However,it's quite easy to fix things up so that we can support that case,provided that it is known that we will never call ExecutorRun() asecond time for the same QueryDesc. Add infrastructure to signalthis, and cross-checks to make sure that a caller who claims this istrue doesn't later reneg.While that pattern never happens with queries received directly from aclient -- there's no way to know whether multiple Execute messageswill be sent unless the first one requests all the rows -- it's prettycommon for queries originating from procedural languages, which oftenlimit the result to a single tuple or to a user-specified number oftuples.This commit doesn't actually enable parallelism in any additionalcases, because currently none of the places that would be able tobenefit from this infrastructure pass CURSOR_OPT_PARALLEL_OK in thefirst place, but it makes it much more palatable to passCURSOR_OPT_PARALLEL_OK in places where we currently don't, because iteliminates some cases where we'd end up having to run the parallelplan serially.Patch by me, based on some ideas from Rafia Sabih and corrected byRafia Sabih based on feedback from Dilip Kumar and myself.Discussion:http://postgr.es/m/CA+TgmobXEhvHbJtWDuPZM9bVSLiTj-kShxQJ2uM5GPDze9fRYA@mail.gmail.com1 parent218f515 commit691b8d5
File tree
19 files changed
+73
-38
lines changed- contrib
- auto_explain
- pg_stat_statements
- src
- backend
- commands
- executor
- tcop
- include
- executor
- tcop
- utils
19 files changed
+73
-38
lines changedLines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 |
| - | |
| 64 | + | |
65 | 65 |
| |
66 | 66 |
| |
67 | 67 |
| |
| |||
257 | 257 |
| |
258 | 258 |
| |
259 | 259 |
| |
260 |
| - | |
| 260 | + | |
| 261 | + | |
261 | 262 |
| |
262 | 263 |
| |
263 | 264 |
| |
264 | 265 |
| |
265 | 266 |
| |
266 |
| - | |
| 267 | + | |
267 | 268 |
| |
268 |
| - | |
| 269 | + | |
269 | 270 |
| |
270 | 271 |
| |
271 | 272 |
| |
|
Lines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
290 | 290 |
| |
291 | 291 |
| |
292 | 292 |
| |
293 |
| - | |
| 293 | + | |
294 | 294 |
| |
295 | 295 |
| |
296 | 296 |
| |
| |||
871 | 871 |
| |
872 | 872 |
| |
873 | 873 |
| |
874 |
| - | |
| 874 | + | |
| 875 | + | |
875 | 876 |
| |
876 | 877 |
| |
877 | 878 |
| |
878 | 879 |
| |
879 | 880 |
| |
880 |
| - | |
| 881 | + | |
881 | 882 |
| |
882 |
| - | |
| 883 | + | |
883 | 884 |
| |
884 | 885 |
| |
885 | 886 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2074 | 2074 |
| |
2075 | 2075 |
| |
2076 | 2076 |
| |
2077 |
| - | |
| 2077 | + | |
2078 | 2078 |
| |
2079 | 2079 |
| |
2080 | 2080 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
347 | 347 |
| |
348 | 348 |
| |
349 | 349 |
| |
350 |
| - | |
| 350 | + | |
351 | 351 |
| |
352 | 352 |
| |
353 | 353 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
530 | 530 |
| |
531 | 531 |
| |
532 | 532 |
| |
533 |
| - | |
| 533 | + | |
534 | 534 |
| |
535 | 535 |
| |
536 | 536 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
742 | 742 |
| |
743 | 743 |
| |
744 | 744 |
| |
745 |
| - | |
| 745 | + | |
746 | 746 |
| |
747 | 747 |
| |
748 | 748 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
424 | 424 |
| |
425 | 425 |
| |
426 | 426 |
| |
427 |
| - | |
| 427 | + | |
428 | 428 |
| |
429 | 429 |
| |
430 | 430 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
395 | 395 |
| |
396 | 396 |
| |
397 | 397 |
| |
398 |
| - | |
| 398 | + | |
399 | 399 |
| |
400 | 400 |
| |
401 | 401 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
301 | 301 |
| |
302 | 302 |
| |
303 | 303 |
| |
304 |
| - | |
| 304 | + | |
305 | 305 |
| |
306 | 306 |
| |
307 | 307 |
| |
|
Lines changed: 26 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
88 |
| - | |
| 88 | + | |
| 89 | + | |
89 | 90 |
| |
90 | 91 |
| |
91 | 92 |
| |
| |||
288 | 289 |
| |
289 | 290 |
| |
290 | 291 |
| |
291 |
| - | |
| 292 | + | |
| 293 | + | |
292 | 294 |
| |
293 | 295 |
| |
294 |
| - | |
| 296 | + | |
295 | 297 |
| |
296 |
| - | |
| 298 | + | |
297 | 299 |
| |
298 | 300 |
| |
299 | 301 |
| |
300 | 302 |
| |
301 |
| - | |
| 303 | + | |
302 | 304 |
| |
303 | 305 |
| |
304 | 306 |
| |
| |||
345 | 347 |
| |
346 | 348 |
| |
347 | 349 |
| |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
348 | 355 |
| |
349 | 356 |
| |
350 | 357 |
| |
351 | 358 |
| |
352 | 359 |
| |
353 | 360 |
| |
354 | 361 |
| |
355 |
| - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
356 | 365 |
| |
357 | 366 |
| |
358 | 367 |
| |
| |||
1595 | 1604 |
| |
1596 | 1605 |
| |
1597 | 1606 |
| |
1598 |
| - | |
| 1607 | + | |
| 1608 | + | |
1599 | 1609 |
| |
1600 | 1610 |
| |
1601 | 1611 |
| |
| |||
1611 | 1621 |
| |
1612 | 1622 |
| |
1613 | 1623 |
| |
1614 |
| - | |
1615 |
| - | |
1616 |
| - | |
1617 |
| - | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
1618 | 1628 |
| |
1619 |
| - | |
| 1629 | + | |
1620 | 1630 |
| |
1621 | 1631 |
| |
1622 | 1632 |
| |
| |||
1687 | 1697 |
| |
1688 | 1698 |
| |
1689 | 1699 |
| |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
1690 | 1703 |
| |
| 1704 | + | |
1691 | 1705 |
| |
1692 | 1706 |
| |
1693 | 1707 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
853 | 853 |
| |
854 | 854 |
| |
855 | 855 |
| |
856 |
| - | |
| 856 | + | |
857 | 857 |
| |
858 | 858 |
| |
859 | 859 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
855 | 855 |
| |
856 | 856 |
| |
857 | 857 |
| |
858 |
| - | |
| 858 | + | |
859 | 859 |
| |
860 | 860 |
| |
861 | 861 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2305 | 2305 |
| |
2306 | 2306 |
| |
2307 | 2307 |
| |
2308 |
| - | |
| 2308 | + | |
2309 | 2309 |
| |
2310 | 2310 |
| |
2311 | 2311 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1101 | 1101 |
| |
1102 | 1102 |
| |
1103 | 1103 |
| |
| 1104 | + | |
1104 | 1105 |
| |
1105 | 1106 |
| |
1106 | 1107 |
| |
| |||
1985 | 1986 |
| |
1986 | 1987 |
| |
1987 | 1988 |
| |
| 1989 | + | |
1988 | 1990 |
| |
1989 | 1991 |
| |
1990 | 1992 |
| |
|
Lines changed: 16 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
| 93 | + | |
| 94 | + | |
| 95 | + | |
93 | 96 |
| |
94 | 97 |
| |
95 | 98 |
| |
| |||
152 | 155 |
| |
153 | 156 |
| |
154 | 157 |
| |
155 |
| - | |
| 158 | + | |
156 | 159 |
| |
157 | 160 |
| |
158 | 161 |
| |
| |||
679 | 682 |
| |
680 | 683 |
| |
681 | 684 |
| |
682 |
| - | |
| 685 | + | |
683 | 686 |
| |
684 | 687 |
| |
685 | 688 |
| |
| |||
712 | 715 |
| |
713 | 716 |
| |
714 | 717 |
| |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
715 | 722 |
| |
716 | 723 |
| |
717 | 724 |
| |
| |||
918 | 925 |
| |
919 | 926 |
| |
920 | 927 |
| |
921 |
| - | |
| 928 | + | |
| 929 | + | |
922 | 930 |
| |
923 | 931 |
| |
924 | 932 |
| |
| |||
957 | 965 |
| |
958 | 966 |
| |
959 | 967 |
| |
960 |
| - | |
| 968 | + | |
| 969 | + | |
961 | 970 |
| |
962 | 971 |
| |
963 | 972 |
| |
| |||
1394 | 1403 |
| |
1395 | 1404 |
| |
1396 | 1405 |
| |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
1397 | 1409 |
| |
1398 | 1410 |
| |
1399 | 1411 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 |
| |
51 | 54 |
| |
52 | 55 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
84 |
| - | |
| 84 | + | |
| 85 | + | |
85 | 86 |
| |
86 | 87 |
| |
87 | 88 |
| |
| |||
176 | 177 |
| |
177 | 178 |
| |
178 | 179 |
| |
179 |
| - | |
| 180 | + | |
180 | 181 |
| |
181 |
| - | |
| 182 | + | |
182 | 183 |
| |
183 | 184 |
| |
184 | 185 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
37 |
| - | |
| 37 | + | |
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
141 | 141 |
| |
142 | 142 |
| |
143 | 143 |
| |
| 144 | + | |
144 | 145 |
| |
145 | 146 |
| |
146 | 147 |
| |
|
0 commit comments
Comments
(0)