forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit505c008
committed
Restore preprocess_groupclause()
0452b46 made optimizer explore alternative orderings of group-by pathkeys.It eliminated preprocess_groupclause(), which was intended to match itemsbetween GROUP BY and ORDER BY. Instead, get_useful_group_keys_orderings()function generates orderings of GROUP BY elements at the time of groupingpaths generation. The get_useful_group_keys_orderings() function takes intoaccount 3 orderings of GROUP BY pathkeys and clauses: original order as writtenin GROUP BY, matching ORDER BY clauses as much as possible, and matching theinput path as much as possible. Given that even before0452b46,preprocess_groupclause() could change the original order of GROUP BY clauseswe don't need to consider it apart from ordering matching ORDER BY clauses.This commit restores preprocess_groupclause() to provide an ordering ofGROUP BY elements matching ORDER BY before generation of paths. The newversion of preprocess_groupclause() takes into account an incremental sort.The get_useful_group_keys_orderings() function now takes into 2 orderings ofGROUP BY elements: the order generated preprocess_groupclause() and the ordermatching the input path as much as possible.Discussion:https://postgr.es/m/CAPpHfdvyWLMGwvxaf%3D7KAp-z-4mxbSH8ti2f6mNOQv5metZFzg%40mail.gmail.comAuthor: Alexander KorotkovReviewed-by: Andrei Lepikhov, Pavel Borisov1 parent0c1af2c commit505c008
File tree
4 files changed
+108
-67
lines changed- src
- backend/optimizer
- path
- plan
- include/nodes
- test/regress/expected
4 files changed
+108
-67
lines changedLines changed: 5 additions & 50 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
447 | 447 |
| |
448 | 448 |
| |
449 | 449 |
| |
450 |
| - | |
451 |
| - | |
452 |
| - | |
453 |
| - | |
454 |
| - | |
455 |
| - | |
456 |
| - | |
457 |
| - | |
458 |
| - | |
459 |
| - | |
460 |
| - | |
461 |
| - | |
462 |
| - | |
463 |
| - | |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 | 450 |
| |
471 | 451 |
| |
472 | 452 |
| |
| |||
475 | 455 |
| |
476 | 456 |
| |
477 | 457 |
| |
478 |
| - | |
| 458 | + | |
479 | 459 |
| |
480 |
| - | |
481 |
| - | |
482 |
| - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
483 | 463 |
| |
484 | 464 |
| |
485 | 465 |
| |
| |||
526 | 506 |
| |
527 | 507 |
| |
528 | 508 |
| |
529 |
| - | |
530 |
| - | |
531 |
| - | |
532 |
| - | |
533 |
| - | |
534 |
| - | |
535 |
| - | |
536 |
| - | |
537 |
| - | |
538 |
| - | |
539 |
| - | |
540 |
| - | |
541 |
| - | |
542 |
| - | |
543 |
| - | |
544 |
| - | |
545 |
| - | |
546 |
| - | |
547 |
| - | |
548 |
| - | |
549 |
| - | |
550 |
| - | |
551 |
| - | |
552 |
| - | |
553 |
| - | |
554 |
| - | |
| 509 | + | |
555 | 510 |
| |
556 | 511 |
| |
557 | 512 |
| |
|
Lines changed: 95 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
140 |
| - | |
| 140 | + | |
141 | 141 |
| |
142 | 142 |
| |
143 | 143 |
| |
| |||
1422 | 1422 |
| |
1423 | 1423 |
| |
1424 | 1424 |
| |
1425 |
| - | |
| 1425 | + | |
1426 | 1426 |
| |
1427 | 1427 |
| |
1428 | 1428 |
| |
| |||
2169 | 2169 |
| |
2170 | 2170 |
| |
2171 | 2171 |
| |
2172 |
| - | |
| 2172 | + | |
2173 | 2173 |
| |
2174 | 2174 |
| |
2175 | 2175 |
| |
| |||
2821 | 2821 |
| |
2822 | 2822 |
| |
2823 | 2823 |
| |
2824 |
| - | |
2825 |
| - | |
2826 |
| - | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
2827 | 2849 |
| |
2828 | 2850 |
| |
2829 |
| - | |
| 2851 | + | |
2830 | 2852 |
| |
2831 | 2853 |
| |
2832 | 2854 |
| |
2833 | 2855 |
| |
| 2856 | + | |
2834 | 2857 |
| |
2835 |
| - | |
| 2858 | + | |
| 2859 | + | |
2836 | 2860 |
| |
2837 |
| - | |
2838 |
| - | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
2839 | 2868 |
| |
2840 |
| - | |
| 2869 | + | |
2841 | 2870 |
| |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
2842 | 2924 |
| |
2843 | 2925 |
| |
2844 | 2926 |
| |
| |||
4170 | 4252 |
| |
4171 | 4253 |
| |
4172 | 4254 |
| |
4173 |
| - | |
| 4255 | + | |
4174 | 4256 |
| |
4175 | 4257 |
| |
4176 | 4258 |
| |
| |||
4359 | 4441 |
| |
4360 | 4442 |
| |
4361 | 4443 |
| |
4362 |
| - | |
| 4444 | + | |
4363 | 4445 |
| |
4364 | 4446 |
| |
4365 | 4447 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
426 | 426 |
| |
427 | 427 |
| |
428 | 428 |
| |
429 |
| - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
430 | 434 |
| |
431 | 435 |
| |
432 | 436 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
901 | 901 |
| |
902 | 902 |
| |
903 | 903 |
| |
904 |
| - | |
| 904 | + | |
905 | 905 |
| |
906 | 906 |
| |
907 | 907 |
| |
908 |
| - | |
| 908 | + | |
909 | 909 |
| |
910 | 910 |
| |
911 | 911 |
| |
912 |
| - | |
| 912 | + | |
913 | 913 |
| |
914 | 914 |
| |
915 | 915 |
| |
|
0 commit comments
Comments
(0)