Re: Get rid of redundant StringInfo accumulation

From: Daniil Davydov <3danissimo(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Get rid of redundant StringInfo accumulation
Date: 2026-03-31 14:49:59
Message-ID: CAJDiXgjK0EsCoKf_QeeWAne5an2rFmM7YKpQ1C3opVCmOCCSzw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Mar 31, 2026 at 9:07 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> Do you mean that the new message_level_is_interesting() call isn't
> noticeable? Or that the extra work to build the StringInfo can't be
> noticed in an unpatched version?

I think that both message_level_is_interesting call and StringInfo building
are taking negligibly little time compared to the time of the entire request.
Of course I can create some synthetic test : huge loop with (for example)
KnownAssignedXidsDisplay call. This test IIUC will show that my patch makes
things better. But I guess this is not what you expect from me.

> If it's the latter, then what's the point?

TBH, I didn't notice that message_level_is_interesting is not considered for
the LOG level.. Anyway, I am still thinking about code consistency and possibly
noticeable changes related to lwlocks (see below).

> Your opening email seems to indicate that you noticed the issue from
> looking at the code. So, it appears that you didn't do this because
> you noticed that there was an actual measurable overhead and you saw a
> way to fix it. If that's the case then perhaps you've just assumed
> this will make a meaningful difference. If I've misunderstood that,
> please correct me and show us your test cases and the performance
> results.

You're precisely right. I noticed this issue from looking at the code (while
working on some other feature). So I do not have any benchmarks, which I think
can be created only for the changes in lock.c and proc.c (since there is a
lock acquired there). I will try to create such a benchmark. I hope it won't
be as synthetic as I imagine it now.

Please note, that I don't have any information about the typical
log_lock_failures/log_lock_waits parameters configuration in a production.

--
Best regards,
Daniil Davydov

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Geier 2026-03-31 14:54:16 Re: Add pg_stat_vfdcache view for VFD cache statistics
Previous Message Yugo Nagata 2026-03-31 14:47:45 Re: Adjust error message for CREATE STATISTICS to account for expressions