Re: Optimize SnapBuildPurgeOlderTxn: use in-place compaction instead of temporary array
| От | Kirill Reshke |
|---|---|
| Тема | Re: Optimize SnapBuildPurgeOlderTxn: use in-place compaction instead of temporary array |
| Дата | |
| Msg-id | CALdSSPigR5SqwqA_KFZOCDH8jw26Mj8V6tOdL5d_AgujjwPe5w@mail.gmail.com обсуждение исходный текст |
| Ответ на | Optimize SnapBuildPurgeOlderTxn: use in-place compaction instead of temporary array (Xuneng Zhou <xunengzhou@gmail.com>) |
| Ответы |
Re: Optimize SnapBuildPurgeOlderTxn: use in-place compaction instead of temporary array
Re: Optimize SnapBuildPurgeOlderTxn: use in-place compaction instead of temporary array |
| Список | pgsql-hackers |
On Sat, 18 Oct 2025 at 12:50, Xuneng Zhou <xunengzhou@gmail.com> wrote: > > Hi Hackers, Hi! > The SnapBuildPurgeOlderTxn function previously used a suboptimal > method to remove old XIDs from the committed.xip array. It allocated a > temporary workspace array, copied the surviving elements into it, and > then copied them back, incurring unnecessary memory allocation and > multiple data copies. > > This patch refactors the logic to use a standard two-pointer, in-place > compaction algorithm. The new approach filters the array in a single > pass with no extra memory allocation, improving both CPU and memory > efficiency. > > No behavioral changes are expected. This resolves a TODO comment > expecting a more efficient algorithm. > Indeed, these changes look correct. I wonder why b89e151054a0 did this place this way, hope we do not miss anything here. Can we construct a microbenchmark here which will show some benefit? -- Best regards, Kirill Reshke
В списке pgsql-hackers по дате отправления: