forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdb632fb
committed
Allow ordered partition scans in more cases
959d00e added the ability to make use of an Append node instead of aMergeAppend when we wanted to perform a scan of a partitioned table andthe required sort order was the same as the partitioned keys and thepartitioned table was defined in such a way that earlier partitions wereguaranteed to only contain lower-order values than later partitions.However, previously we didn't allow these ordered partition scans forLIST partitioned table when there were any partitions that allowedmultiple Datums. This was a very cheap check to make and we could likelyhave done a little better by checking if there were interleavedpartitions, but at the time we didn't have visibility about whichpartitions were pruned, so we still may have disallowed cases where allinterleaved partitions were pruned.Since475dbd0, we now have knowledge of pruned partitions, we can do amuch better job inside partitions_are_ordered().Here we pass which partitions survived partition pruning intopartitions_are_ordered() and, for LIST partitioning, have it check to seeif any live partitions exist that are also in the new "interleaved_parts"field defined in PartitionBoundInfo.For RANGE partitioning we can relax the code which caused the partitionsto be unordered if a DEFAULT partition existed. Since we now know whichpartitions were pruned, partitions_are_ordered() now returns true when theDEFAULT partition was pruned.Reviewed-by: Amit Langote, Zhihong YuDiscussion:https://postgr.es/m/CAApHDvrdoN_sXU52i=QDXe2k3WAo=EVry29r2+Tq2WYcn2xhEA@mail.gmail.com1 parent475dbd0 commitdb632fb
File tree
6 files changed
+235
-27
lines changed- src
- backend
- optimizer/path
- partitioning
- include/partitioning
- test/regress
- expected
- sql
6 files changed
+235
-27
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1689 | 1689 |
| |
1690 | 1690 |
| |
1691 | 1691 |
| |
1692 |
| - | |
| 1692 | + | |
1693 | 1693 |
| |
1694 | 1694 |
| |
1695 | 1695 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
704 | 704 |
| |
705 | 705 |
| |
706 | 706 |
| |
707 |
| - | |
| 707 | + | |
708 | 708 |
| |
709 | 709 |
| |
710 | 710 |
| |
|
Lines changed: 81 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
395 | 395 |
| |
396 | 396 |
| |
397 | 397 |
| |
| 398 | + | |
398 | 399 |
| |
399 | 400 |
| |
400 | 401 |
| |
| |||
543 | 544 |
| |
544 | 545 |
| |
545 | 546 |
| |
| 547 | + | |
546 | 548 |
| |
547 | 549 |
| |
548 | 550 |
| |
| |||
607 | 609 |
| |
608 | 610 |
| |
609 | 611 |
| |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
610 | 675 |
| |
611 | 676 |
| |
612 | 677 |
| |
| |||
750 | 815 |
| |
751 | 816 |
| |
752 | 817 |
| |
| 818 | + | |
753 | 819 |
| |
754 | 820 |
| |
755 | 821 |
| |
| |||
993 | 1059 |
| |
994 | 1060 |
| |
995 | 1061 |
| |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
996 | 1065 |
| |
997 | 1066 |
| |
998 | 1067 |
| |
| |||
2780 | 2849 |
| |
2781 | 2850 |
| |
2782 | 2851 |
| |
2783 |
| - | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
2784 | 2855 |
| |
2785 | 2856 |
| |
2786 | 2857 |
| |
2787 | 2858 |
| |
2788 | 2859 |
| |
2789 |
| - | |
| 2860 | + | |
2790 | 2861 |
| |
2791 | 2862 |
| |
2792 | 2863 |
| |
| |||
2798 | 2869 |
| |
2799 | 2870 |
| |
2800 | 2871 |
| |
2801 |
| - | |
2802 |
| - | |
2803 |
| - | |
| 2872 | + | |
| 2873 | + | |
2804 | 2874 |
| |
2805 |
| - | |
| 2875 | + | |
| 2876 | + | |
2806 | 2877 |
| |
2807 | 2878 |
| |
2808 | 2879 |
| |
2809 | 2880 |
| |
2810 | 2881 |
| |
2811 | 2882 |
| |
2812 |
| - | |
2813 |
| - | |
2814 |
| - | |
2815 |
| - | |
2816 |
| - | |
2817 |
| - | |
2818 |
| - | |
2819 |
| - | |
2820 |
| - | |
2821 |
| - | |
2822 |
| - | |
2823 |
| - | |
| 2883 | + | |
| 2884 | + | |
2824 | 2885 |
| |
2825 |
| - | |
2826 |
| - | |
2827 |
| - | |
2828 |
| - | |
2829 |
| - | |
| 2886 | + | |
2830 | 2887 |
| |
2831 |
| - | |
2832 | 2888 |
| |
| 2889 | + | |
2833 | 2890 |
| |
2834 | 2891 |
| |
2835 | 2892 |
| |
|
Lines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
64 | 76 |
| |
65 | 77 |
| |
66 | 78 |
| |
| |||
70 | 82 |
| |
71 | 83 |
| |
72 | 84 |
| |
| 85 | + | |
| 86 | + | |
| 87 | + | |
73 | 88 |
| |
74 | 89 |
| |
75 | 90 |
| |
| |||
102 | 117 |
| |
103 | 118 |
| |
104 | 119 |
| |
105 |
| - | |
| 120 | + | |
| 121 | + | |
106 | 122 |
| |
107 | 123 |
| |
108 | 124 |
| |
|
Lines changed: 108 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2180 | 2180 |
| |
2181 | 2181 |
| |
2182 | 2182 |
| |
| 2183 | + | |
| 2184 | + | |
2183 | 2185 |
| |
2184 | 2186 |
| |
2185 | 2187 |
| |
| |||
2208 | 2210 |
| |
2209 | 2211 |
| |
2210 | 2212 |
| |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
2211 | 2317 |
| |
| 2318 | + | |
| 2319 | + | |
2212 | 2320 |
| |
2213 | 2321 |
| |
2214 | 2322 |
| |
|
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
775 | 775 |
| |
776 | 776 |
| |
777 | 777 |
| |
| 778 | + | |
| 779 | + | |
778 | 780 |
| |
779 | 781 |
| |
780 | 782 |
| |
| |||
789 | 791 |
| |
790 | 792 |
| |
791 | 793 |
| |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
792 | 817 |
| |
793 | 818 |
| |
| 819 | + | |
| 820 | + | |
794 | 821 |
| |
795 | 822 |
| |
796 | 823 |
| |
|
0 commit comments
Comments
(0)