- Notifications
You must be signed in to change notification settings - Fork5k
Commit40af10b
committed
Use Generation memory contexts to store tuples in sorts
The general usage pattern when we store tuples in tuplesort.c is thatwe store a series of tuples one by one then either perform a sort or spillthem to disk. In the common case, there is no pfreeing of already storedtuples. For the common case since we do not individually pfree tuples, wehave very little need for aset.c memory allocation behavior whichmaintains freelists and always rounds allocation sizes up to the nextpower of 2 size.Here we conditionally use generation.c contexts for storing tuples intuplesort.c when the sort will never be bounded. Unfortunately, thememory context to store tuples is already created by the time any callswould be made to tuplesort_set_bound(), so here we add a new sort optionthat allows callers to specify if they're going to need a bounded sort ornot. We'll use a standard aset.c allocator when this sort option is notset.Extension authors must ensure that the TUPLESORT_ALLOWBOUNDED flag isused when calling tuplesort_begin_* for any sorts that make a call totuplesort_set_bound().Author: David RowleyReviewed-by: Andy FanDiscussion:https://postgr.es/m/CAApHDvoH4ASzsAOyHcxkuY01Qf++8JJ0paw+03dk+W25tQEcNQ@mail.gmail.com1 parent77bae39 commit40af10b
File tree
4 files changed
+24
-5
lines changed- src
- backend
- executor
- utils/sort
- include/utils
4 files changed
+24
-5
lines changedLines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
315 | 315 |
| |
316 | 316 |
| |
317 | 317 |
| |
318 |
| - | |
| 318 | + | |
319 | 319 |
| |
320 | 320 |
| |
321 | 321 |
| |
| |||
616 | 616 |
| |
617 | 617 |
| |
618 | 618 |
| |
| 619 | + | |
| 620 | + | |
619 | 621 |
| |
620 | 622 |
| |
621 | 623 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
99 | 99 |
| |
100 | 100 |
| |
101 | 101 |
| |
| 102 | + | |
| 103 | + | |
102 | 104 |
| |
103 | 105 |
| |
104 | 106 |
| |
|
Lines changed: 16 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
935 | 935 |
| |
936 | 936 |
| |
937 | 937 |
| |
938 |
| - | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
939 | 943 |
| |
940 |
| - | |
941 |
| - | |
942 |
| - | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
943 | 953 |
| |
944 | 954 |
| |
945 | 955 |
| |
| |||
1444 | 1454 |
| |
1445 | 1455 |
| |
1446 | 1456 |
| |
| 1457 | + | |
| 1458 | + | |
1447 | 1459 |
| |
1448 | 1460 |
| |
1449 | 1461 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
| 95 | + | |
| 96 | + | |
| 97 | + | |
95 | 98 |
| |
96 | 99 |
| |
97 | 100 |
| |
|
0 commit comments
Comments
(0)