Re: log_postmaster_stats

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Cc: Quan Zongliang <quanzongliang(at)yeah(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: log_postmaster_stats
Date: 2026-11-23 18:49:27
Message-ID: CA+Tgmoah9ODsRohsntYEpdC0VN8ko7H38kifoO3k=YR2HAkrEA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 23, 2026 at 4:51 AM Jakub Wartak
<jakub(dot)wartak(at)enterprisedb(dot)com> wrote:
> > > described). With CPU usage, I think people would agree that anything
> > > >=70-80% is clear sign of overload (so that's just nice on/off toggle).
> >
> > To be absolutely clear, I do not agree with that and strongly suspect
> > it isn't generally true.
>
> Hm, so you do not agree on the specific threshold values used or on the whole
> idea of having information of overloaded specific subsystem?

Uh, neither of those, really. There are two things here that I don't like:

1. I don't like printing out a message that talks about possible
overload. It's fine to print out fact that may indicate to the
knowledgeable user that the postmaster is overloaded, but the message
wording should just be factual. Saying that there were %d connection
attempts in the last %d seconds is fine; saying that this potentially
indicates overload is too opinionated. Let the user decide what the
numbers mean.

2. I don't like using CPU usage to judge overload. I think it's
unreliable. I am not saying we should never have a setting that works
that way, but for me the bar to accept that would be very high. I'm
not completely certain that every "high CPU usage" alert I've ever
seen in my entire career was a false positive, but I am sure that the
false positives *greatly* outnumber the true positives, like by an
order of magnitude or more.

I feel pretty confident, for example, that on a typical system, >100
new connections per second is probably an indication of a problem.
Even if it doesn't produce high CPU usage, it is likely to produce
suboptimal results -- all of those new sessions will have constantly
cold caches. It might be a sign that the connection pooler isn't
working as intended, or that a connection pooler is not used but is
needed. Even when it's not an indication of a problem, like just after
a restart when something moves quickly to reestablish the connection
pool, the user will be well-placed to understand why it happened and
disregard it. On the other hand, I have limited confidence that the
postmaster running at >75% CPU is an indication of a problem, and no
confidence at all that it is an indication of *this specific problem*.
I suspect there are a bunch of things that could cause high CPU usage,
especially on tiny little machines, and I bet some of them are totally
benign, and others are real problems. Users who see this message won't
know if they have a real problem, and they also won't know what it is.
In my experience, that kind of message is unhelpful.

--
Robert Haas
Databricks

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-11-23 18:56:46 Re: nbtree: opt-in leaf key prefix compression
Previous Message Zsolt Parragi 2026-11-23 18:46:00 Re: Unlogged materialized views