forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3b0f776
committed
Fix some questionable edge-case behaviors in add_path() and friends.
add_path_precheck was doing exact comparisons of path costs, but it reallyneeds to do them fuzzily to be sure it won't reject paths that couldsurvive add_path's comparisons. (This can only matter if the initial costestimate is very close to the final one, but that turns out to often betrue.)Also, it should ignore startup cost for this purpose if and only ifcompare_path_costs_fuzzily would do so. The previous coding always ignoredstartup cost for parameterized paths, which is wrong as of commit3f59be8; it could result in improper early rejection of paths thatwe care about for SEMI/ANTI joins. It also always considered startup costfor unparameterized paths, which is just as wrong though the only effect isto waste planner cycles on paths that can't survive. Instead, it shouldconsider startup cost only when directed to by the consider_startup/consider_param_startup relation flags.Likewise, compare_path_costs_fuzzily should have symmetrical behaviorfor parameterized and unparameterized paths. In this case, the bestanswer seems to be that after establishing that total costs are fuzzilyequal, we should compare startup costs whether or not the consider_xxxflags are on. That is what it's always done for unparameterized paths,so let's make the behavior for parameterized paths match.These issues were noted while developing the SEMI/ANTI join costing fixof commit3f59be8, but we chose not to back-patch these fixes,because they can cause changes in the planner's choices amongnearly-same-cost plans. (There is in fact one minor change in plan choicewithin the core regression tests.) Destabilizing plan choices in backbranches without very clear improvements is frowned on, so we'll just fixthis in HEAD.1 parent3f59be8 commit3b0f776
File tree
2 files changed
+53
-49
lines changed- src
- backend/optimizer/util
- test/regress/expected
2 files changed
+53
-49
lines changedLines changed: 27 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 |
| |
42 | 49 |
| |
43 | 50 |
| |
| |||
140 | 147 |
| |
141 | 148 |
| |
142 | 149 |
| |
143 |
| - | |
144 |
| - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
145 | 154 |
| |
146 | 155 |
| |
147 | 156 |
| |
| |||
177 | 186 |
| |
178 | 187 |
| |
179 | 188 |
| |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
| 189 | + | |
| 190 | + | |
189 | 191 |
| |
190 | 192 |
| |
191 | 193 |
| |
192 | 194 |
| |
193 |
| - | |
194 |
| - | |
| 195 | + | |
195 | 196 |
| |
196 | 197 |
| |
197 | 198 |
| |
| |||
434 | 435 |
| |
435 | 436 |
| |
436 | 437 |
| |
437 |
| - | |
438 |
| - | |
| 438 | + | |
439 | 439 |
| |
440 |
| - | |
| 440 | + | |
| 441 | + | |
441 | 442 |
| |
442 | 443 |
| |
443 | 444 |
| |
| |||
624 | 625 |
| |
625 | 626 |
| |
626 | 627 |
| |
| 628 | + | |
627 | 629 |
| |
628 | 630 |
| |
629 | 631 |
| |
630 | 632 |
| |
631 | 633 |
| |
| 634 | + | |
| 635 | + | |
| 636 | + | |
632 | 637 |
| |
633 | 638 |
| |
634 | 639 |
| |
| |||
640 | 645 |
| |
641 | 646 |
| |
642 | 647 |
| |
643 |
| - | |
644 |
| - | |
645 |
| - | |
| 648 | + | |
646 | 649 |
| |
647 |
| - | |
| 650 | + | |
648 | 651 |
| |
649 |
| - | |
650 |
| - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
651 | 655 |
| |
652 |
| - | |
| 656 | + | |
653 | 657 |
| |
654 | 658 |
| |
655 | 659 |
| |
|
Lines changed: 26 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3771 | 3771 |
| |
3772 | 3772 |
| |
3773 | 3773 |
| |
3774 |
| - | |
3775 |
| - | |
3776 |
| - | |
| 3774 | + | |
| 3775 | + | |
| 3776 | + | |
3777 | 3777 |
| |
3778 |
| - | |
| 3778 | + | |
3779 | 3779 |
| |
3780 | 3780 |
| |
3781 | 3781 |
| |
3782 | 3782 |
| |
3783 | 3783 |
| |
3784 | 3784 |
| |
3785 | 3785 |
| |
3786 |
| - | |
3787 |
| - | |
3788 | 3786 |
| |
3789 | 3787 |
| |
3790 | 3788 |
| |
3791 | 3789 |
| |
3792 | 3790 |
| |
3793 | 3791 |
| |
| 3792 | + | |
| 3793 | + | |
3794 | 3794 |
| |
3795 |
| - | |
3796 |
| - | |
3797 | 3795 |
| |
3798 | 3796 |
| |
3799 | 3797 |
| |
3800 | 3798 |
| |
3801 | 3799 |
| |
3802 | 3800 |
| |
| 3801 | + | |
| 3802 | + | |
3803 | 3803 |
| |
3804 |
| - | |
| 3804 | + | |
3805 | 3805 |
| |
| 3806 | + | |
3806 | 3807 |
| |
| 3808 | + | |
3807 | 3809 |
| |
| 3810 | + | |
3808 | 3811 |
| |
| 3812 | + | |
3809 | 3813 |
| |
3810 | 3814 |
| |
3811 |
| - | |
3812 |
| - | |
3813 |
| - | |
3814 |
| - | |
3815 |
| - | |
| 3815 | + | |
3816 | 3816 |
| |
3817 |
| - | |
| 3817 | + | |
3818 | 3818 |
| |
| 3819 | + | |
3819 | 3820 |
| |
| 3821 | + | |
3820 | 3822 |
| |
| 3823 | + | |
3821 | 3824 |
| |
| 3825 | + | |
3822 | 3826 |
| |
3823 | 3827 |
| |
3824 |
| - | |
3825 |
| - | |
3826 |
| - | |
3827 |
| - | |
3828 |
| - | |
| 3828 | + | |
3829 | 3829 |
| |
3830 |
| - | |
| 3830 | + | |
3831 | 3831 |
| |
| 3832 | + | |
3832 | 3833 |
| |
| 3834 | + | |
3833 | 3835 |
| |
| 3836 | + | |
3834 | 3837 |
| |
| 3838 | + | |
3835 | 3839 |
| |
3836 | 3840 |
| |
3837 |
| - | |
3838 |
| - | |
3839 |
| - | |
3840 |
| - | |
3841 |
| - | |
| 3841 | + | |
3842 | 3842 |
| |
3843 | 3843 |
| |
3844 | 3844 |
| |
|
0 commit comments
Comments
(0)