- Notifications
You must be signed in to change notification settings - Fork5k
Commit0229106
committed
Overload index_form_tuple to allow the memory context to be supplied
40af10b changed things so we make use of a generation memory context forstoring tuples to be sorted by tuplesort.c. That change does not playnicely with the changes made in9f03ca9 (back in 2014). That commitchanged things so that index_form_tuple() is called while switched intothe tuplestore's tuplecontext. In order to fetch the tuple from the index,index_form_tuple() must do various memory allocations which are unrelatedto the storage of the final returned tuple. Although all of theseallocations are pfree'd, the fact that we now use a generation contextmeans that the memory for these pfree'd allocations won't be used again byany other allocation due to generation.c's lack of freelists. This couldresult in sorts used for building indexes exceeding maintenance_work_memby a very large amount.Here we fix it so we no longer allocate anything apart from the tupleitself into the generation context by adding a new version ofindex_form_tuple named index_form_tuple_context, which can be called tospecify the MemoryContext to allocate the tuple into.Discussion:https://postgr.es/m/CAApHDvrHQkiFRHiGiAS-LMOvJN-eK-s762=tVzBz8ZqUea-a_A@mail.gmail.comBackpatch-through: 15, where40af10b was added.1 parent2d7ead8 commit0229106
File tree
3 files changed
+31
-8
lines changed- src
- backend
- access/common
- utils/sort
- include/access
3 files changed
+31
-8
lines changedLines changed: 24 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
36 | 52 |
| |
37 |
| - | |
| 53 | + | |
38 | 54 |
| |
39 | 55 |
| |
40 | 56 |
| |
41 | 57 |
| |
42 | 58 |
| |
43 | 59 |
| |
| 60 | + | |
| 61 | + | |
44 | 62 |
| |
45 | 63 |
| |
46 | 64 |
| |
47 |
| - | |
48 |
| - | |
49 |
| - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
50 | 69 |
| |
51 | 70 |
| |
52 | 71 |
| |
| |||
143 | 162 |
| |
144 | 163 |
| |
145 | 164 |
| |
146 |
| - | |
| 165 | + | |
147 | 166 |
| |
148 | 167 |
| |
149 | 168 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1884 | 1884 |
| |
1885 | 1885 |
| |
1886 | 1886 |
| |
1887 |
| - | |
| 1887 | + | |
1888 | 1888 |
| |
1889 | 1889 |
| |
1890 | 1890 |
| |
1891 | 1891 |
| |
1892 |
| - | |
| 1892 | + | |
| 1893 | + | |
1893 | 1894 |
| |
1894 | 1895 |
| |
1895 | 1896 |
| |
| |||
1899 | 1900 |
| |
1900 | 1901 |
| |
1901 | 1902 |
| |
1902 |
| - | |
| 1903 | + | |
1903 | 1904 |
| |
1904 | 1905 |
| |
1905 | 1906 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
150 | 150 |
| |
151 | 151 |
| |
152 | 152 |
| |
| 153 | + | |
| 154 | + | |
| 155 | + | |
153 | 156 |
| |
154 | 157 |
| |
155 | 158 |
| |
|
0 commit comments
Comments
(0)