- Notifications
You must be signed in to change notification settings - Fork5.1k
Commit03d40e4
committed
Teach UNION planner to remove dummy inputs
This adjusts UNION planning so that the planner produces more optimalplans when one or more of the UNION's subqueries have been proven to beempty (a dummy rel).If any of the inputs are empty, then that input can be removed from theAppend / MergeAppend. Previously, a const-false "Result" node wouldappear to represent this. Removing empty inputs has a few extrabenefits when only 1 union child remains as it means the Append orMergeAppend can be removed in setrefs.c, making the plan slightly fasterto execute. Also, we can provide better n_distinct estimates by lookingat the sole remaining input rel's statistics.Author: David Rowley <dgrowleyml@gmail.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CAApHDvri53PPF76c3M94_QNWbJfXjyCnjXuj_2=LYM-0m8WZtw@mail.gmail.com1 parent5092aae commit03d40e4
File tree
3 files changed
+125
-9
lines changed- src
- backend/optimizer/prep
- test/regress
- expected
- sql
3 files changed
+125
-9
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
523 | 523 |
| |
524 | 524 |
| |
525 | 525 |
| |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
526 | 533 |
| |
527 | 534 |
| |
528 | 535 |
| |
| |||
763 | 770 |
| |
764 | 771 |
| |
765 | 772 |
| |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
766 | 777 |
| |
767 | 778 |
| |
768 | 779 |
| |
| |||
812 | 823 |
| |
813 | 824 |
| |
814 | 825 |
| |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
815 | 835 |
| |
816 | 836 |
| |
817 | 837 |
| |
| |||
876 | 896 |
| |
877 | 897 |
| |
878 | 898 |
| |
879 |
| - | |
880 |
| - | |
881 |
| - | |
882 |
| - | |
883 |
| - | |
884 |
| - | |
885 |
| - | |
886 |
| - | |
887 |
| - | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
888 | 926 |
| |
889 | 927 |
| |
890 | 928 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1216 | 1216 |
| |
1217 | 1217 |
| |
1218 | 1218 |
| |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
1219 | 1270 |
| |
1220 | 1271 |
| |
1221 | 1272 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
459 | 459 |
| |
460 | 460 |
| |
461 | 461 |
| |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
462 | 489 |
| |
463 | 490 |
| |
464 | 491 |
| |
|
0 commit comments
Comments
(0)