forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit41efb83
committed
Move resolution of AlternativeSubPlan choices to the planner.
When commitbd3dadd introduced AlternativeSubPlans, I had someambitions towards allowing the choice of subplan to change duringexecution. That has not happened, or even been thought about, in theensuing twelve years; so it seems like a failed experiment. So let'srip that out and resolve the choice of subplan at the end of planning(in setrefs.c) rather than during executor startup. This has a numberof positive benefits:* Removal of a few hundred lines of executor code, sinceAlternativeSubPlans need no longer be supported there.* Removal of executor-startup overhead (particularly, initializationof subplans that won't be used).* Removal of incidental costs of having a larger plan tree, such astree-scanning and copying costs in the plancache; not to mentionsetrefs.c's own costs of processing the discarded subplans.* EXPLAIN no longer has to print a weird (and undocumented)representation of an AlternativeSubPlan choice; it sees only thesubplan actually used. This should mean less confusion for users.* Since setrefs.c knows which subexpression of a plan node it'sworking on at any instant, it's possible to adjust the estimatednumber of executions of the subplan based on that. For example,we should usually estimate more executions of a qual expressionthan a targetlist expression. The implementation used here ispretty simplistic, because we don't want to expend a lot of cycleson the issue; but it's better than ignoring the point entirely,as the executor had to.That last point might possibly result in shifting the choicebetween hashed and non-hashed EXISTS subplans in a few cases,but in general this patch isn't meant to change planner choices.Since we're doing the resolution so late, it's really impossibleto change any plan choices outside the AlternativeSubPlan itself.Patch by me; thanks to David Rowley for review.Discussion:https://postgr.es/m/1992952.1592785225@sss.pgh.pa.us1 parent3c88199 commit41efb83
File tree
20 files changed
+412
-295
lines changed- src
- backend
- executor
- jit/llvm
- nodes
- optimizer/plan
- utils/adt
- include
- executor
- nodes
- test/regress
- expected
- sql
20 files changed
+412
-295
lines changedLines changed: 0 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1104 | 1104 |
| |
1105 | 1105 |
| |
1106 | 1106 |
| |
1107 |
| - | |
1108 |
| - | |
1109 |
| - | |
1110 |
| - | |
1111 |
| - | |
1112 |
| - | |
1113 |
| - | |
1114 |
| - | |
1115 |
| - | |
1116 |
| - | |
1117 |
| - | |
1118 |
| - | |
1119 |
| - | |
1120 |
| - | |
1121 |
| - | |
1122 |
| - | |
1123 |
| - | |
1124 | 1107 |
| |
1125 | 1108 |
| |
1126 | 1109 |
| |
|
Lines changed: 0 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
431 | 431 |
| |
432 | 432 |
| |
433 | 433 |
| |
434 |
| - | |
435 | 434 |
| |
436 | 435 |
| |
437 | 436 |
| |
| |||
1536 | 1535 |
| |
1537 | 1536 |
| |
1538 | 1537 |
| |
1539 |
| - | |
1540 |
| - | |
1541 |
| - | |
1542 |
| - | |
1543 |
| - | |
1544 |
| - | |
1545 |
| - | |
1546 |
| - | |
1547 | 1538 |
| |
1548 | 1539 |
| |
1549 | 1540 |
| |
| |||
3868 | 3859 |
| |
3869 | 3860 |
| |
3870 | 3861 |
| |
3871 |
| - | |
3872 |
| - | |
3873 |
| - | |
3874 |
| - | |
3875 |
| - | |
3876 |
| - | |
3877 |
| - | |
3878 |
| - | |
3879 |
| - | |
3880 |
| - | |
3881 |
| - | |
3882 |
| - | |
3883 |
| - | |
3884 |
| - | |
3885 | 3862 |
| |
3886 | 3863 |
| |
3887 | 3864 |
| |
|
Lines changed: 0 additions & 80 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1303 | 1303 |
| |
1304 | 1304 |
| |
1305 | 1305 |
| |
1306 |
| - | |
1307 |
| - | |
1308 |
| - | |
1309 |
| - | |
1310 |
| - | |
1311 |
| - | |
1312 |
| - | |
1313 |
| - | |
1314 |
| - | |
1315 |
| - | |
1316 |
| - | |
1317 |
| - | |
1318 |
| - | |
1319 |
| - | |
1320 |
| - | |
1321 |
| - | |
1322 |
| - | |
1323 |
| - | |
1324 |
| - | |
1325 |
| - | |
1326 |
| - | |
1327 |
| - | |
1328 |
| - | |
1329 |
| - | |
1330 |
| - | |
1331 |
| - | |
1332 |
| - | |
1333 |
| - | |
1334 |
| - | |
1335 |
| - | |
1336 |
| - | |
1337 |
| - | |
1338 |
| - | |
1339 |
| - | |
1340 |
| - | |
1341 |
| - | |
1342 |
| - | |
1343 |
| - | |
1344 |
| - | |
1345 |
| - | |
1346 |
| - | |
1347 |
| - | |
1348 |
| - | |
1349 |
| - | |
1350 |
| - | |
1351 |
| - | |
1352 |
| - | |
1353 |
| - | |
1354 |
| - | |
1355 |
| - | |
1356 |
| - | |
1357 |
| - | |
1358 |
| - | |
1359 |
| - | |
1360 |
| - | |
1361 |
| - | |
1362 |
| - | |
1363 |
| - | |
1364 |
| - | |
1365 |
| - | |
1366 |
| - | |
1367 |
| - | |
1368 |
| - | |
1369 |
| - | |
1370 |
| - | |
1371 |
| - | |
1372 |
| - | |
1373 |
| - | |
1374 |
| - | |
1375 |
| - | |
1376 |
| - | |
1377 |
| - | |
1378 |
| - | |
1379 |
| - | |
1380 |
| - | |
1381 |
| - | |
1382 |
| - | |
1383 |
| - | |
1384 |
| - | |
1385 |
| - |
Lines changed: 0 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1918 | 1918 |
| |
1919 | 1919 |
| |
1920 | 1920 |
| |
1921 |
| - | |
1922 |
| - | |
1923 |
| - | |
1924 |
| - | |
1925 |
| - | |
1926 |
| - | |
1927 | 1921 |
| |
1928 | 1922 |
| |
1929 | 1923 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
105 |
| - | |
106 | 105 |
| |
107 | 106 |
| |
108 | 107 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2254 | 2254 |
| |
2255 | 2255 |
| |
2256 | 2256 |
| |
| 2257 | + | |
2257 | 2258 |
| |
2258 | 2259 |
| |
2259 | 2260 |
| |
|
Lines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
629 | 629 |
| |
630 | 630 |
| |
631 | 631 |
| |
| 632 | + | |
| 633 | + | |
632 | 634 |
| |
633 | 635 |
| |
634 | 636 |
| |
| |||
759 | 761 |
| |
760 | 762 |
| |
761 | 763 |
| |
762 |
| - | |
763 |
| - | |
764 |
| - | |
765 | 764 |
| |
766 | 765 |
| |
767 | 766 |
| |
|
0 commit comments
Comments
(0)