pgsql: Use stack-allocated StringInfoDatas, where possible

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use stack-allocated StringInfoDatas, where possible
Date: 2026-04-12 22:43:54
Message-ID: E1wC3Wz-000heo-2M@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use stack-allocated StringInfoDatas, where possible

6d0eba662 already did most of the changes, but some new ones snuck in
just prior to that commit, so these got missed.

Having these short-lived StringInfoDatas on the stack rather than having
them get palloc'd by makeStringInfo() is simply for performance as it
saves doing a 2nd palloc.

Since this code is new to v19, it makes sense to improve it now rather
than wait until we branch as having v19 and v20 differ here just makes it
harder to backpatch fixes in this area.

Author: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Reviewed-by: David Rowley <dgrowleyml(at)gmail(dot)com>
Discussion: https://postgr.es/m/adt4wpj4FZwR+S7I@ip-10-97-1-34.eu-west-3.compute.internal

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a63bbc811d41b3567eb37fe2636e660a852dbbf2

Modified Files
--------------
src/backend/replication/logical/sequencesync.c | 39 ++++++++++++++------------
1 file changed, 21 insertions(+), 18 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2026-04-12 23:40:24 pgsql: Fix unlikely overflow bug in bms_next_member()
Previous Message Tom Lane 2026-04-12 17:55:26 Re: pgsql: Reduce log level of some logical decoding messages from LOG to D