| From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
|---|---|
| To: | Daniil Davydov <3danissimo(at)gmail(dot)com> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Get rid of redundant StringInfo accumulation |
| Date: | 2026-03-29 21:51:49 |
| Message-ID: | CAHut+PvX8s0KBFeKOq+O1T+R0pdBGOp445QK1p6nVScnxSLFaA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Mar 29, 2026 at 11:26 PM Daniil Davydov <3danissimo(at)gmail(dot)com> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2026-03-29 22:02:37 | Re: Adding REPACK [concurrently] |
| Previous Message | Hannu Krosing | 2026-03-29 21:49:38 | Re: Patch: dumping tables data in multiple chunks in pg_dump |