- Notifications
You must be signed in to change notification settings - Fork5
Commit5b7b551
committed
Revise parameterized-path mechanism to fix assorted issues.
This patch adjusts the treatment of parameterized paths so that all pathswith the same parameterization (same set of required outer rels) for thesame relation will have the same rowcount estimate. We cache the rowcountestimates to ensure that property, and hopefully save a few cycles too.Doing this makes it practical for add_path_precheck to operate withouta rowcount estimate: it need only assume that paths with differentparameterizations never dominate each other, which is close enough totrue anyway for coarse filtering, because normally a more-parameterizedpath should yield fewer rows thanks to having more join clauses to apply.In add_path, we do the full nine yards of comparing rowcount estimatesalong with everything else, so that we can discard parameterized paths thatdon't actually have an advantage. This fixes some issues I'd found withadd_path rejecting parameterized paths on the grounds that they were moreexpensive than not-parameterized ones, even though they yielded many fewerrows and hence would be cheaper once subsequent joining was considered.To make the same-rowcounts assumption valid, we have to require that anyparameterized path enforce *all* join clauses that could be obtained fromthe particular set of outer rels, even if not all of them are useful forindexing. This is required at both base scans and joins. It's a goodthing anyway since the net impact is that join quals are checked at thelowest practical level in the join tree. Hence, discard the originalrather ad-hoc mechanism for choosing parameterization joinquals, and builda better one that has a more principled rule for when clauses can be moved.The original rule was actually buggy anyway for lack of knowledge aboutwhich relations are part of an outer join's outer side; getting this rightrequires adding an outer_relids field to RestrictInfo.1 parentcd1f4db commit5b7b551
File tree
30 files changed
+1787
-776
lines changed- contrib/file_fdw
- src
- backend
- nodes
- optimizer
- path
- plan
- prep
- util
- include
- nodes
- optimizer
- test/regress
- expected
- sql
30 files changed
+1787
-776
lines changedLines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
468 | 468 |
| |
469 | 469 |
| |
470 | 470 |
| |
471 |
| - | |
472 | 471 |
| |
473 | 472 |
| |
474 | 473 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1844 | 1844 |
| |
1845 | 1845 |
| |
1846 | 1846 |
| |
| 1847 | + | |
1847 | 1848 |
| |
1848 | 1849 |
| |
1849 | 1850 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
815 | 815 |
| |
816 | 816 |
| |
817 | 817 |
| |
| 818 | + | |
818 | 819 |
| |
819 | 820 |
| |
820 | 821 |
| |
|
Lines changed: 23 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1461 | 1461 |
| |
1462 | 1462 |
| |
1463 | 1463 |
| |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
1464 | 1467 |
| |
1465 | 1468 |
| |
1466 | 1469 |
| |
1467 | 1470 |
| |
1468 | 1471 |
| |
1469 | 1472 |
| |
1470 | 1473 |
| |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
1471 | 1479 |
| |
1472 | 1480 |
| |
1473 | 1481 |
| |
1474 | 1482 |
| |
1475 |
| - | |
1476 |
| - | |
1477 | 1483 |
| |
1478 | 1484 |
| |
1479 | 1485 |
| |
| |||
1727 | 1733 |
| |
1728 | 1734 |
| |
1729 | 1735 |
| |
| 1736 | + | |
1730 | 1737 |
| |
1731 | 1738 |
| |
1732 | 1739 |
| |
| |||
1817 | 1824 |
| |
1818 | 1825 |
| |
1819 | 1826 |
| |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
1820 | 1837 |
| |
1821 | 1838 |
| |
1822 | 1839 |
| |
| |||
1830 | 1847 |
| |
1831 | 1848 |
| |
1832 | 1849 |
| |
| 1850 | + | |
1833 | 1851 |
| |
1834 | 1852 |
| |
1835 | 1853 |
| |
| |||
3001 | 3019 |
| |
3002 | 3020 |
| |
3003 | 3021 |
| |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
3004 | 3025 |
| |
3005 | 3026 |
| |
3006 | 3027 |
| |
|
Lines changed: 34 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
751 | 751 |
| |
752 | 752 |
| |
753 | 753 |
| |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
754 | 780 |
| |
755 | 781 |
| |
756 | 782 |
| |
| |||
763 | 789 |
| |
764 | 790 |
| |
765 | 791 |
| |
766 |
| - | |
767 |
| - | |
768 |
| - | |
769 |
| - | |
770 |
| - | |
771 |
| - | |
772 |
| - | |
773 |
| - | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
774 | 800 |
| |
775 | 801 |
| |
776 | 802 |
|
Lines changed: 57 additions & 37 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
67 | 67 |
| |
68 | 68 |
| |
69 | 69 |
| |
70 |
| - | |
71 |
| - | |
| 70 | + | |
72 | 71 |
| |
73 | 72 |
| |
74 | 73 |
| |
| |||
375 | 374 |
| |
376 | 375 |
| |
377 | 376 |
| |
378 |
| - | |
| 377 | + | |
379 | 378 |
| |
380 | 379 |
| |
381 | 380 |
| |
| |||
717 | 716 |
| |
718 | 717 |
| |
719 | 718 |
| |
720 |
| - | |
| 719 | + | |
721 | 720 |
| |
722 | 721 |
| |
723 | 722 |
| |
| |||
777 | 776 |
| |
778 | 777 |
| |
779 | 778 |
| |
780 |
| - | |
| 779 | + | |
781 | 780 |
| |
782 | 781 |
| |
783 | 782 |
| |
784 | 783 |
| |
785 | 784 |
| |
786 |
| - | |
787 |
| - | |
| 785 | + | |
788 | 786 |
| |
789 | 787 |
| |
790 |
| - | |
791 |
| - | |
792 |
| - | |
793 |
| - | |
794 |
| - | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
795 | 799 |
| |
796 | 800 |
| |
797 | 801 |
| |
798 | 802 |
| |
| 803 | + | |
799 | 804 |
| |
800 | 805 |
| |
801 | 806 |
| |
| |||
812 | 817 |
| |
813 | 818 |
| |
814 | 819 |
| |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
815 | 832 |
| |
816 | 833 |
| |
817 |
| - | |
818 | 834 |
| |
819 |
| - | |
820 |
| - | |
821 |
| - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
822 | 838 |
| |
823 | 839 |
| |
824 | 840 |
| |
| |||
830 | 846 |
| |
831 | 847 |
| |
832 | 848 |
| |
833 |
| - | |
834 |
| - | |
| 849 | + | |
835 | 850 |
| |
836 | 851 |
| |
837 | 852 |
| |
838 | 853 |
| |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
839 | 866 |
| |
840 | 867 |
| |
841 | 868 |
| |
842 | 869 |
| |
843 |
| - | |
844 |
| - | |
| 870 | + | |
845 | 871 |
| |
846 | 872 |
| |
847 | 873 |
| |
| |||
864 | 890 |
| |
865 | 891 |
| |
866 | 892 |
| |
867 |
| - | |
| 893 | + | |
868 | 894 |
| |
869 | 895 |
| |
870 | 896 |
| |
871 | 897 |
| |
872 |
| - | |
| 898 | + | |
873 | 899 |
| |
874 | 900 |
| |
875 | 901 |
| |
876 | 902 |
| |
877 |
| - | |
878 |
| - | |
| 903 | + | |
879 | 904 |
| |
880 | 905 |
| |
881 | 906 |
| |
882 |
| - | |
883 |
| - | |
884 |
| - | |
885 |
| - | |
886 |
| - | |
887 |
| - | |
888 |
| - | |
889 |
| - | |
890 |
| - | |
| 907 | + | |
| 908 | + | |
891 | 909 |
| |
892 | 910 |
| |
893 | 911 |
| |
| |||
909 | 927 |
| |
910 | 928 |
| |
911 | 929 |
| |
912 |
| - | |
| 930 | + | |
| 931 | + | |
913 | 932 |
| |
914 | 933 |
| |
915 | 934 |
| |
916 | 935 |
| |
917 |
| - | |
| 936 | + | |
| 937 | + | |
918 | 938 |
| |
919 | 939 |
| |
920 | 940 |
| |
| |||
958 | 978 |
| |
959 | 979 |
| |
960 | 980 |
| |
961 |
| - | |
| 981 | + | |
962 | 982 |
| |
963 | 983 |
| |
964 | 984 |
| |
| |||
1112 | 1132 |
| |
1113 | 1133 |
| |
1114 | 1134 |
| |
1115 |
| - | |
| 1135 | + | |
1116 | 1136 |
| |
1117 | 1137 |
| |
1118 | 1138 |
| |
|
0 commit comments
Comments
(0)