public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Smith <[email protected]>
To: Daniil Davydov <[email protected]>
Cc: Postgres hackers <[email protected]>
Subject: Re: Get rid of redundant StringInfo accumulation
Date: Mon, 30 Mar 2026 08:51:49 +1100
Message-ID: <CAHut+PvX8s0KBFeKOq+O1T+R0pdBGOp445QK1p6nVScnxSLFaA@mail.gmail.com> (raw)
In-Reply-To: <CAJDiXgi=Vcp1nh2UoZ5=7BCoR+uXoYzqMsfOfga-XxSUHjFj5Q@mail.gmail.com>
References: <CAJDiXgi=Vcp1nh2UoZ5=7BCoR+uXoYzqMsfOfga-XxSUHjFj5Q@mail.gmail.com>
On Sun, Mar 29, 2026 at 11:26 PM Daniil Davydov <[email protected]> wrote:
>
> Hi,
>
> I have noticed that there are several places in the code where we are
> creating StringInfo in order to log its content. But this work may be wasted
> if the specified log level is not interesting both for client and server.
> I.e. now we can allocate memory for StringInfo which will never be displayed.
>
> I think that at first we should check whether log level is interesting and
> only then start creating the StringInfo.
>
> Please, see the attached patch that fixes it. I hope I have found all the
> places where it would be appropriate.
>
Hi,
1.
@@ -108,6 +108,9 @@ ReportApplyConflict(EState *estate, ResultRelInfo
*relinfo, int elevel,
Relation localrel = relinfo->ri_RelationDesc;
StringInfoData err_detail;
+ if (!message_level_is_interesting(elevel))
+ return;
+
AFAICT, this change will also cause the
pgstat_report_subscription_conflict() to be skipped. But that call was
not associated with the log level.
======
Kind Regards,
Peter Smith.
Fujitsu Australia
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Get rid of redundant StringInfo accumulation
In-Reply-To: <CAHut+PvX8s0KBFeKOq+O1T+R0pdBGOp445QK1p6nVScnxSLFaA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox