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
