forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd37aa3d
committed
Allow nodeSort to perform Datum sorts for byref types
Here we add a new 'copy' parameter to tuplesort_getdatum so that we caninstruct the function not to datumCopy() byref Datums before returning.Similar to91e9e89, this can provide significant performanceimprovements in nodeSort when sorting by a single byref column and thesort's targetlist contains only that column.This allows us to re-enable Datum sorts for byref types which was disabledin3a58176 due to a reported memory leak.Additionally, here we slightly optimize DISTINCT aggregates so that we nolonger perform any datumCopy() when we find the current value not to bedistinct from the previous value. Previously the code would always take acopy of the most recent Datum and pfree the previous value, even when thevalues were the same. Testing shows a small but noticeable performanceincrease when aggregate transitions are skipped due to the currenttransition value being the same as the prior one.Author: David RowleyDiscussion:https://postgr.es/m/CAApHDvqS6wC5U==k9Hd26E4EQXH3QR67-T4=Q1rQ36NGvjfVSg@mail.gmail.comDiscussion:https://postgr.es/m/CAApHDvqHonfe9G1cVaKeHbDx70R_zCrM3qP2AGXpGrieSKGnhA@mail.gmail.com1 parenta5fc464 commitd37aa3d
File tree
6 files changed
+57
-32
lines changed- src
- backend
- access/heap
- executor
- utils
- adt
- sort
- include/utils
6 files changed
+57
-32
lines changedLines changed: 2 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1879 | 1879 |
| |
1880 | 1880 |
| |
1881 | 1881 |
| |
1882 |
| - | |
| 1882 | + | |
| 1883 | + | |
1883 | 1884 |
| |
1884 | 1885 |
| |
1885 | 1886 |
| |
1886 | 1887 |
| |
1887 | 1888 |
| |
1888 |
| - | |
1889 |
| - | |
1890 |
| - | |
1891 |
| - | |
1892 |
| - | |
1893 | 1889 |
| |
1894 | 1890 |
| |
1895 | 1891 |
| |
|
Lines changed: 20 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
879 | 879 |
| |
880 | 880 |
| |
881 | 881 |
| |
882 |
| - | |
| 882 | + | |
883 | 883 |
| |
884 | 884 |
| |
885 | 885 |
| |
| |||
900 | 900 |
| |
901 | 901 |
| |
902 | 902 |
| |
903 |
| - | |
904 |
| - | |
905 |
| - | |
| 903 | + | |
| 904 | + | |
906 | 905 |
| |
907 | 906 |
| |
908 | 907 |
| |
909 | 908 |
| |
910 |
| - | |
911 |
| - | |
912 |
| - | |
913 |
| - | |
914 |
| - | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
915 | 926 |
| |
916 | 927 |
| |
917 | 928 |
| |
918 | 929 |
| |
919 |
| - | |
920 |
| - | |
921 | 930 |
| |
922 | 931 |
| |
923 | 932 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
201 |
| - | |
| 201 | + | |
| 202 | + | |
202 | 203 |
| |
203 | 204 |
| |
204 | 205 |
| |
| |||
278 | 279 |
| |
279 | 280 |
| |
280 | 281 |
| |
281 |
| - | |
| 282 | + | |
282 | 283 |
| |
283 | 284 |
| |
284 |
| - | |
| 285 | + | |
285 | 286 |
| |
286 | 287 |
| |
287 | 288 |
| |
|
Lines changed: 14 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
482 | 482 |
| |
483 | 483 |
| |
484 | 484 |
| |
485 |
| - | |
| 485 | + | |
| 486 | + | |
486 | 487 |
| |
487 | 488 |
| |
488 | 489 |
| |
| |||
581 | 582 |
| |
582 | 583 |
| |
583 | 584 |
| |
584 |
| - | |
| 585 | + | |
| 586 | + | |
585 | 587 |
| |
586 | 588 |
| |
587 | 589 |
| |
| |||
592 | 594 |
| |
593 | 595 |
| |
594 | 596 |
| |
595 |
| - | |
| 597 | + | |
| 598 | + | |
596 | 599 |
| |
597 | 600 |
| |
598 | 601 |
| |
| |||
817 | 820 |
| |
818 | 821 |
| |
819 | 822 |
| |
820 |
| - | |
| 823 | + | |
| 824 | + | |
821 | 825 |
| |
822 | 826 |
| |
823 | 827 |
| |
| |||
945 | 949 |
| |
946 | 950 |
| |
947 | 951 |
| |
948 |
| - | |
949 |
| - | |
| 952 | + | |
| 953 | + | |
950 | 954 |
| |
951 | 955 |
| |
952 | 956 |
| |
| |||
966 | 970 |
| |
967 | 971 |
| |
968 | 972 |
| |
969 |
| - | |
970 |
| - | |
| 973 | + | |
| 974 | + | |
971 | 975 |
| |
972 | 976 |
| |
973 | 977 |
| |
| |||
1073 | 1077 |
| |
1074 | 1078 |
| |
1075 | 1079 |
| |
1076 |
| - | |
| 1080 | + | |
| 1081 | + | |
1077 | 1082 |
| |
1078 | 1083 |
| |
1079 | 1084 |
| |
|
Lines changed: 16 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
848 | 848 |
| |
849 | 849 |
| |
850 | 850 |
| |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
851 | 861 |
| |
852 | 862 |
| |
853 |
| - | |
| 863 | + | |
854 | 864 |
| |
855 | 865 |
| |
856 | 866 |
| |
| |||
879 | 889 |
| |
880 | 890 |
| |
881 | 891 |
| |
882 |
| - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
883 | 897 |
| |
884 | 898 |
| |
885 | 899 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
439 | 439 |
| |
440 | 440 |
| |
441 | 441 |
| |
442 |
| - | |
| 442 | + | |
443 | 443 |
| |
444 | 444 |
| |
445 | 445 |
| |
|
0 commit comments
Comments
(0)