forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7481c6c
committed
Make entirely-dummy appendrels get marked as such in set_append_rel_size.
The planner generally expects that the estimated rowcount of any relationis at least one row, *unless* it has been proven empty by constraintexclusion or similar mechanisms, which is marked by installing a dummy pathas the rel's cheapest path (cf. IS_DUMMY_REL). When I split upallpaths.c's processing of base rels into separate set_base_rel_sizes andset_base_rel_pathlists steps, the intention was that dummy rels would getmarked as such during the "set size" step; this is what justifies an Assertin indxpath.c's get_loop_count that other relations should either be dummyor have positive rowcount. Unfortunately I didn't get that quite rightfor append relations: if all the child rels have been proven empty thenset_append_rel_size would come up with a rowcount of zero, which iscorrect, but it didn't then do set_dummy_rel_pathlist. (We would haveended up with the right state after set_append_rel_pathlist, but that'stoo late, if we generate indexpaths for some other rel first.)In addition to fixing the actual bug, I installed an Assert enforcing thisconvention in set_rel_size; that then allows simplification of a coupleof now-redundant tests for zero rowcount in set_append_rel_size.Also, to cover the possibility that third-party FDWs have been carelessabout not returning a zero rowcount estimate, apply clamp_row_est towhatever an FDW comes up with as the rows estimate.Per report from Andreas Seltenreich. Back-patch to 9.2. Earlier branchesdid not have the separation between set_base_rel_sizes andset_base_rel_pathlists steps, so there was no intermediate state where anappendrel would have had inconsistent rowcount and pathlist. It's possiblethat adding the Assert to set_rel_size would be a good idea in olderbranches too; but since they're not under development any more, it's likelynot worth the trouble.1 parent13d0053 commit7481c6c
File tree
3 files changed
+94
-42
lines changed- src
- backend/optimizer/path
- test/regress
- expected
- sql
3 files changed
+94
-42
lines changedLines changed: 62 additions & 42 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
360 | 360 |
| |
361 | 361 |
| |
362 | 362 |
| |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
363 | 368 |
| |
364 | 369 |
| |
365 | 370 |
| |
| |||
579 | 584 |
| |
580 | 585 |
| |
581 | 586 |
| |
| 587 | + | |
| 588 | + | |
| 589 | + | |
582 | 590 |
| |
583 | 591 |
| |
584 | 592 |
| |
| |||
608 | 616 |
| |
609 | 617 |
| |
610 | 618 |
| |
| 619 | + | |
611 | 620 |
| |
612 | 621 |
| |
613 | 622 |
| |
| |||
628 | 637 |
| |
629 | 638 |
| |
630 | 639 |
| |
| 640 | + | |
631 | 641 |
| |
632 | 642 |
| |
633 | 643 |
| |
| |||
755 | 765 |
| |
756 | 766 |
| |
757 | 767 |
| |
| 768 | + | |
| 769 | + | |
| 770 | + | |
758 | 771 |
| |
759 | 772 |
| |
760 | 773 |
| |
761 |
| - | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
762 | 789 |
| |
763 |
| - | |
764 |
| - | |
| 790 | + | |
| 791 | + | |
765 | 792 |
| |
766 |
| - | |
767 |
| - | |
768 |
| - | |
769 |
| - | |
770 |
| - | |
771 |
| - | |
772 |
| - | |
773 |
| - | |
774 |
| - | |
775 |
| - | |
| 793 | + | |
776 | 794 |
| |
777 |
| - | |
778 |
| - | |
| 795 | + | |
| 796 | + | |
779 | 797 |
| |
780 |
| - | |
| 798 | + | |
| 799 | + | |
781 | 800 |
| |
782 |
| - | |
783 |
| - | |
| 801 | + | |
784 | 802 |
| |
785 |
| - | |
786 |
| - | |
787 |
| - | |
788 |
| - | |
789 |
| - | |
790 |
| - | |
791 |
| - | |
792 |
| - | |
793 |
| - | |
794 |
| - | |
795 |
| - | |
796 |
| - | |
| 803 | + | |
797 | 804 |
| |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
798 | 810 |
| |
799 | 811 |
| |
800 | 812 |
| |
801 | 813 |
| |
802 |
| - | |
803 |
| - | |
804 |
| - | |
805 |
| - | |
806 |
| - | |
| 814 | + | |
807 | 815 |
| |
| 816 | + | |
| 817 | + | |
| 818 | + | |
808 | 819 |
| |
809 | 820 |
| |
| 821 | + | |
| 822 | + | |
810 | 823 |
| |
811 | 824 |
| |
812 | 825 |
| |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
813 | 832 |
| |
814 | 833 |
| |
815 |
| - | |
816 |
| - | |
817 |
| - | |
818 |
| - | |
819 |
| - | |
820 |
| - | |
821 |
| - | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
822 | 842 |
| |
823 | 843 |
| |
824 | 844 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2164 | 2164 |
| |
2165 | 2165 |
| |
2166 | 2166 |
| |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
2167 | 2187 |
| |
2168 | 2188 |
| |
2169 | 2189 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
353 | 353 |
| |
354 | 354 |
| |
355 | 355 |
| |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
356 | 367 |
| |
357 | 368 |
| |
358 | 369 |
| |
| |||
1120 | 1131 |
| |
1121 | 1132 |
| |
1122 | 1133 |
| |
| 1134 | + | |
1123 | 1135 |
| |
1124 | 1136 |
| |
1125 | 1137 |
| |
|
0 commit comments
Comments
(0)