forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite83bb10
committed
Adjust definition of cheapest_total_path to work better with LATERAL.
In the initial cut at LATERAL, I kept the rule that cheapest_total_pathwas always unparameterized, which meant it had to be NULL if the relationhas no unparameterized paths. It turns out to work much more nicely ifwe always have *some* path nominated as cheapest-total for each relation.In particular, let's still say it's the cheapest unparameterized path ifthere is one; if not, take the cheapest-total-cost path among those ofthe minimum available parameterization. (The first rule is actuallya special case of the second.)This allows reversion of some temporary lobotomizations I'd put in place.In particular, the planner can now consider hash and merge joins forjoins below a parameter-supplying nestloop, even if there aren't anyunparameterized paths available. This should bring planning ofLATERAL-containing queries to the same level as queries not using thatfeature.Along the way, simplify management of parameterized paths in add_path()and friends. In the original coding for parameterized paths in 9.2,I tried to minimize the logic changes in add_path(), so it just treatedparameterization as yet another dimension of comparison for paths.We later made it ignore pathkeys (sort ordering) of parameterized paths,on the grounds that ordering isn't a useful property for the path on theinside of a nestloop, so we might as well get rid of useless parameterizedpaths as quickly as possible. But we didn't take that reasoning as far aswe should have. Startup cost isn't a useful property inside a nestloopeither, so add_path() ought to discount startup cost of parameterized pathsas well. Having done that, the secondary sorting I'd implemented (inadd_parameterized_path) is no longer needed --- any parameterized path thatsurvives add_path() at all is worth considering at higher levels. So thisshould be a bit faster as well as simpler.1 parent9fe6da5 commite83bb10
File tree
8 files changed
+217
-252
lines changed- src
- backend/optimizer
- geqo
- path
- plan
- util
- include/nodes
- test/regress/expected
8 files changed
+217
-252
lines changedLines changed: 16 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
789 | 789 |
| |
790 | 790 |
| |
791 | 791 |
| |
792 |
| - | |
| 792 | + | |
793 | 793 |
| |
794 | 794 |
| |
795 | 795 |
| |
| |||
799 | 799 |
| |
800 | 800 |
| |
801 | 801 |
| |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
802 | 817 |
|
Lines changed: 2 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 | 105 |
| |
113 | 106 |
| |
114 | 107 |
| |
115 | 108 |
| |
116 |
| - | |
| 109 | + | |
| 110 | + | |
117 | 111 |
| |
118 | 112 |
| |
119 | 113 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
722 | 722 |
| |
723 | 723 |
| |
724 | 724 |
| |
725 |
| - | |
| 725 | + | |
726 | 726 |
| |
727 | 727 |
| |
728 | 728 |
| |
| |||
932 | 932 |
| |
933 | 933 |
| |
934 | 934 |
| |
935 |
| - | |
936 | 935 |
| |
937 | 936 |
| |
938 | 937 |
| |
|
Lines changed: 52 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 |
| |
26 | 29 |
| |
27 | 30 |
| |
| |||
503 | 506 |
| |
504 | 507 |
| |
505 | 508 |
| |
506 |
| - | |
507 |
| - | |
508 |
| - | |
509 |
| - | |
510 |
| - | |
511 |
| - | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
512 | 515 |
| |
513 | 516 |
| |
514 | 517 |
| |
515 | 518 |
| |
516 |
| - | |
517 |
| - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
518 | 527 |
| |
519 | 528 |
| |
520 | 529 |
| |
| |||
714 | 723 |
| |
715 | 724 |
| |
716 | 725 |
| |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
717 | 734 |
| |
718 | 735 |
| |
719 | 736 |
| |
720 | 737 |
| |
721 | 738 |
| |
722 | 739 |
| |
723 |
| - | |
| 740 | + | |
724 | 741 |
| |
725 | 742 |
| |
726 |
| - | |
727 | 743 |
| |
728 | 744 |
| |
729 | 745 |
| |
| |||
756 | 772 |
| |
757 | 773 |
| |
758 | 774 |
| |
759 |
| - | |
| 775 | + | |
760 | 776 |
| |
761 | 777 |
| |
762 | 778 |
| |
763 | 779 |
| |
764 | 780 |
| |
765 | 781 |
| |
766 |
| - | |
767 |
| - | |
768 | 782 |
| |
769 | 783 |
| |
770 | 784 |
| |
| |||
844 | 858 |
| |
845 | 859 |
| |
846 | 860 |
| |
847 |
| - | |
848 |
| - | |
| 861 | + | |
| 862 | + | |
849 | 863 |
| |
850 | 864 |
| |
851 | 865 |
| |
| |||
1126 | 1140 |
| |
1127 | 1141 |
| |
1128 | 1142 |
| |
1129 |
| - | |
1130 |
| - | |
1131 |
| - | |
1132 |
| - | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
1133 | 1151 |
| |
1134 | 1152 |
| |
1135 | 1153 |
| |
| |||
1169 | 1187 |
| |
1170 | 1188 |
| |
1171 | 1189 |
| |
1172 |
| - | |
| 1190 | + | |
| 1191 | + | |
1173 | 1192 |
| |
1174 | 1193 |
| |
1175 | 1194 |
| |
| |||
1193 | 1212 |
| |
1194 | 1213 |
| |
1195 | 1214 |
| |
1196 |
| - | |
1197 |
| - | |
1198 |
| - | |
1199 |
| - | |
1200 |
| - | |
1201 |
| - | |
1202 |
| - | |
1203 |
| - | |
1204 |
| - | |
1205 |
| - | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
1206 | 1226 |
| |
1207 | 1227 |
| |
1208 | 1228 |
| |
| |||
1212 | 1232 |
| |
1213 | 1233 |
| |
1214 | 1234 |
| |
1215 |
| - | |
| 1235 | + | |
1216 | 1236 |
| |
1217 | 1237 |
| |
1218 | 1238 |
| |
| |||
1223 | 1243 |
| |
1224 | 1244 |
| |
1225 | 1245 |
| |
1226 |
| - | |
1227 |
| - | |
| 1246 | + | |
1228 | 1247 |
| |
1229 | 1248 |
| |
1230 | 1249 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
267 | 267 |
| |
268 | 268 |
| |
269 | 269 |
| |
270 |
| - | |
| 270 | + | |
| 271 | + | |
271 | 272 |
| |
272 | 273 |
| |
273 | 274 |
| |
|
0 commit comments
Comments
(0)