forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit42b746d
committed
Remove uses of MemoryContextContains in nodeAgg.c and nodeWindowAgg.c.
MemoryContextContains is no longer reliable in the wake ofc6e0fe1,so we need to get rid of these uses.It appears that there's no really good reason to force the result ofan aggregate's finalfn or serialfn to be allocated in the per-tuplecontext. The only other plausible case is that the result points toor into the aggregate's transition value, and that's fine because itwill last as long as we need it to. (This conclusion depends on theassumption that finalfns are not allowed to scribble on the transitionvalue, but we've long required that.) So we can just drop theMemoryContextContains plus datumCopy business, although we do needto take care to not return a read-write pointer when the transitionvalue is an expanded datum.Likewise, we don't really need to force the result of a windowfunction to be in the output context. In this case, the plausiblealternative is that it's pointing into the temporary tuple slot usedby WinGetFuncArgInPartition or WinGetFuncArgInFrame (since thosefunctions could return such a pointer, which might become the windowfunction's result). That will hold still for long enough, unlessthere is another window function using the same WindowObject.I'm content to always perform a datumCopy when there's more than onesuch function.On net, these changes should provide small speed improvements as wellas removing problematic code.Tom Lane and David RowleyDiscussion:https://postgr.es/m/1913788.1664898906@sss.pgh.pa.us1 parent66c2922 commit42b746d
File tree
4 files changed
+45
-38
lines changed- src
- backend/executor
- test/regress
- expected
- sql
4 files changed
+45
-38
lines changedLines changed: 10 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1028 | 1028 |
| |
1029 | 1029 |
| |
1030 | 1030 |
| |
| 1031 | + | |
| 1032 | + | |
1031 | 1033 |
| |
1032 | 1034 |
| |
1033 | 1035 |
| |
| |||
1112 | 1114 |
| |
1113 | 1115 |
| |
1114 | 1116 |
| |
1115 |
| - | |
1116 |
| - | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1117 | 1121 |
| |
1118 | 1122 |
| |
1119 | 1123 |
| |
1120 |
| - | |
1121 |
| - | |
1122 |
| - | |
1123 |
| - | |
1124 |
| - | |
1125 |
| - | |
1126 |
| - | |
1127 |
| - | |
1128 |
| - | |
1129 |
| - | |
1130 | 1124 |
| |
1131 | 1125 |
| |
1132 | 1126 |
| |
| |||
1176 | 1170 |
| |
1177 | 1171 |
| |
1178 | 1172 |
| |
1179 |
| - | |
1180 |
| - | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
1181 | 1177 |
| |
1182 | 1178 |
| |
1183 | 1179 |
| |
1184 |
| - | |
1185 |
| - | |
1186 |
| - | |
1187 |
| - | |
1188 |
| - | |
1189 |
| - | |
1190 |
| - | |
1191 |
| - | |
1192 | 1180 |
| |
1193 | 1181 |
| |
1194 | 1182 |
| |
|
Lines changed: 14 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
630 | 630 |
| |
631 | 631 |
| |
632 | 632 |
| |
633 |
| - | |
634 |
| - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
635 | 637 |
| |
636 | 638 |
| |
637 | 639 |
| |
638 |
| - | |
639 |
| - | |
640 |
| - | |
641 |
| - | |
642 |
| - | |
643 |
| - | |
644 |
| - | |
645 |
| - | |
646 |
| - | |
647 | 640 |
| |
648 | 641 |
| |
649 | 642 |
| |
| |||
1057 | 1050 |
| |
1058 | 1051 |
| |
1059 | 1052 |
| |
1060 |
| - | |
1061 |
| - | |
1062 |
| - | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1063 | 1058 |
| |
1064 | 1059 |
| |
1065 |
| - | |
1066 |
| - | |
| 1060 | + | |
1067 | 1061 |
| |
1068 | 1062 |
| |
1069 | 1063 |
| |
| |||
3111 | 3105 |
| |
3112 | 3106 |
| |
3113 | 3107 |
| |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
3114 | 3112 |
| |
3115 | 3113 |
| |
3116 | 3114 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
657 | 657 |
| |
658 | 658 |
| |
659 | 659 |
| |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
660 | 677 |
| |
661 | 678 |
| |
662 | 679 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
156 | 160 |
| |
157 | 161 |
| |
158 | 162 |
| |
|
0 commit comments
Comments
(0)