public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[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:52:17 -0400
Message-ID: <eok6kgntbec2vo35xp4eky5ef52ttb7trislyev63ty3ltu533@je4bpifl6spb> (raw)
In-Reply-To: <CAJDiXgi=Vcp1nh2UoZ5=7BCoR+uXoYzqMsfOfga-XxSUHjFj5Q@mail.gmail.com>
References: <CAJDiXgi=Vcp1nh2UoZ5=7BCoR+uXoYzqMsfOfga-XxSUHjFj5Q@mail.gmail.com>

Hi,

On 2026-03-29 19:26:11 +0700, Daniil Davydov wrote:
> 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.

I don't see when the overhead of creating an populating the string info ever
matters in these cases. This is optimizing something that never can matter for
real world performance.  Even if it were worth optimizing them, I doubt that
the log level check is useful here, because most if not all of these are
logged with a level that's logged in nearly all installations.

Greetings,

Andres Freund





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: <eok6kgntbec2vo35xp4eky5ef52ttb7trislyev63ty3ltu533@je4bpifl6spb>

* 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