Re: Add pg_stat_log_messages: cumulative statistics about server log messages (was: Add contrib module pg_stat_log: cumulative statistics about server log messages) - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Add pg_stat_log_messages: cumulative statistics about server log messages (was: Add contrib module pg_stat_log: cumulative statistics about server log messages)
Date
Msg-id CAAc5aFOoNSw7LiyDN0CtJKxTxOSMXYmuR4fqprSPJc-1=sicsw@mail.gmail.com
Whole thread
In response to Add pg_stat_log_messages: cumulative statistics about server log messages (was: Add contrib module pg_stat_log: cumulative statistics about server log messages)  (Fabrízio Mello <fabrizio@planetscale.com>)
List pgsql-hackers
Hi Fabrizio,

On Tue, Sep 29, 2026 at 1:21 AM Fabrízio Mello <fabrizio@planetscale.com> wrote:
On Thu, Sep 3, 2026 at 4:58 AM Daniel Gustafsson <daniel@yesql.se> wrote:
>
> Your email didn't motivate why this extension should be in core instead of
> maintained as an external extension?
>

Thanks Daniel, that's a fair point, and after Nikolay's strong case for
core [1] I'm convinced this belongs there: error counters by SQLSTATE
are fundamental monitoring, counters are far easier to expose to
monitoring systems than log access (which mixes diagnostics with
statements and potentially sensitive data), and external extensions
take a long time to propagate to managed platforms, if ever.

So here is v2, reworked from a contrib module into a builtin cumulative
statistics kind with a core view.  Summary of what changed:

Thanks for the updated patch!

I did not look at it in details, just at what outcome it would provide and I think it would also
make sense to provide this information on a per-backend basis. There is ongoing work
to redesign the per-backend statistics infrastructure [1], which, I think, might be worth
considering for this feature.

[1] https://postgr.es/m/anCjoFkGah/uB7lw%40bdtpg

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

pgsql-hackers by date:

Previous
From: Nikhil Kumar Veldanda
Date:
Subject: Re: ZSTD TOAST compression, and an extensible compression method encoding
Next
From: Peter Eisentraut
Date:
Subject: Silence -fsanitize=function where we cast function pointers on purpose