forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6ca015f
committed
Track unowned relations in doubly-linked list
Relations dropped in a single transaction are tracked in a list ofunowned relations. With large number of dropped relations this resultedin poor performance at the end of a transaction, when the relations areremoved from the singly linked list one by one.Commitb416691 attempted to address this issue (particularly when ithappens during recovery) by removing the relations in a reverse order,resulting in O(1) lookups in the list of unowned relations. This didnot work reliably, though, and it was possible to trigger the O(N^2)behavior in various ways.Instead of trying to remove the relations in a specific order withrespect to the linked list, which seems rather fragile, switch to aregular doubly linked. That allows us to remove relations cheaply nomatter where in the list they are.Asb416691 was a bugfix, backpatched to all supported versions, do thesame thing here.Reviewed-by: Alvaro HerreraDiscussion:https://www.postgresql.org/message-id/flat/80c27103-99e4-1d0c-642c-d9f3b94aaa0a%402ndquadrant.comBackpatch-through: 9.41 parent558a916 commit6ca015f
3 files changed
+20
-65
lines changedLines changed: 1 addition & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1699 | 1699 |
| |
1700 | 1700 |
| |
1701 | 1701 |
| |
1702 |
| - | |
1703 |
| - | |
1704 |
| - | |
1705 |
| - | |
1706 |
| - | |
1707 |
| - | |
1708 |
| - | |
| 1702 | + | |
1709 | 1703 |
| |
1710 | 1704 |
| |
1711 | 1705 |
| |
|
Lines changed: 17 additions & 57 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| 21 | + | |
21 | 22 |
| |
22 | 23 |
| |
23 | 24 |
| |
| |||
97 | 98 |
| |
98 | 99 |
| |
99 | 100 |
| |
100 |
| - | |
| 101 | + | |
101 | 102 |
| |
102 | 103 |
| |
103 | 104 |
| |
104 |
| - | |
105 |
| - | |
106 | 105 |
| |
107 | 106 |
| |
108 | 107 |
| |
| |||
165 | 164 |
| |
166 | 165 |
| |
167 | 166 |
| |
168 |
| - | |
| 167 | + | |
169 | 168 |
| |
170 | 169 |
| |
171 | 170 |
| |
| |||
192 | 191 |
| |
193 | 192 |
| |
194 | 193 |
| |
195 |
| - | |
| 194 | + | |
196 | 195 |
| |
197 | 196 |
| |
198 | 197 |
| |
| |||
222 | 221 |
| |
223 | 222 |
| |
224 | 223 |
| |
225 |
| - | |
| 224 | + | |
226 | 225 |
| |
227 | 226 |
| |
228 | 227 |
| |
| |||
246 | 245 |
| |
247 | 246 |
| |
248 | 247 |
| |
249 |
| - | |
250 |
| - | |
251 |
| - | |
252 |
| - | |
253 |
| - | |
254 |
| - | |
255 |
| - | |
256 |
| - | |
257 |
| - | |
258 |
| - | |
259 |
| - | |
260 |
| - | |
261 |
| - | |
262 |
| - | |
263 |
| - | |
264 |
| - | |
265 |
| - | |
266 |
| - | |
267 |
| - | |
268 |
| - | |
269 |
| - | |
270 |
| - | |
271 |
| - | |
272 |
| - | |
273 |
| - | |
274 |
| - | |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
279 |
| - | |
280 |
| - | |
281 |
| - | |
282 |
| - | |
283 |
| - | |
284 |
| - | |
285 |
| - | |
286 |
| - | |
287 |
| - | |
288 |
| - | |
289 |
| - | |
290 |
| - | |
291 |
| - | |
292 |
| - | |
293 |
| - | |
294 |
| - | |
295 |
| - | |
| 248 | + | |
| 249 | + | |
296 | 250 |
| |
297 | 251 |
| |
298 | 252 |
| |
| |||
319 | 273 |
| |
320 | 274 |
| |
321 | 275 |
| |
322 |
| - | |
| 276 | + | |
323 | 277 |
| |
324 | 278 |
| |
325 | 279 |
| |
| |||
812 | 766 |
| |
813 | 767 |
| |
814 | 768 |
| |
| 769 | + | |
| 770 | + | |
815 | 771 |
| |
816 | 772 |
| |
817 | 773 |
| |
818 | 774 |
| |
819 |
| - | |
| 775 | + | |
820 | 776 |
| |
821 |
| - | |
822 |
| - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
823 | 783 |
| |
824 | 784 |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
17 | 18 |
| |
18 | 19 |
| |
19 | 20 |
| |
| |||
71 | 72 |
| |
72 | 73 |
| |
73 | 74 |
| |
74 |
| - | |
| 75 | + | |
75 | 76 |
| |
76 | 77 |
| |
77 | 78 |
| |
|
0 commit comments
Comments
(0)