Re: Reduce padding in WALOpenSegment and XLogReaderState - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: Reduce padding in WALOpenSegment and XLogReaderState
Date
Msg-id an7qwjaCksFBqIms@alvherre.pgsql
Whole thread
Responses Re: Proposal: Conflict log history table for Logical Replication
List pgsql-hackers
Hi

On 2026-Aug-14, Japin Li wrote:

> Hi, hackers
> 
> While reviewing patch [1], I noticed that we can reduce padding in both
> WALOpenSegment and XLogReaderState by reordering a few fields.

What do you think of the idea of changing segcxt so that the directory
name can be allocated to the length of the given directory instead of
the full MAXPGPATH?  We could make ws_dir a pointer that goes just
beyond the end of the struct's sizeof, so that it's all still a single
palloc chunk.  That would probably be a more significant memory savings
improvement.  (Now, xlogreader is not allocated in huge numbers, so
saving a few hundred bytes is not terribly exciting in any case.  But
maybe there are cases where XLogReadRecord shows in profile enough to
make it useful for XLogReaderState to fit better in CPU caches?  I kinda
doubt this whole thing is worth it, but maybe you know of some.)

Regards

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Allow a condition string in an injection point
Next
From: Osama Abdul Qader
Date:
Subject: Re: Fix detection of truncated zstd-compressed backups