Re: Missing wait events (gap analysis) - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Missing wait events (gap analysis)
Date
Msg-id m46aym5wqzfxg6jos5ylb27cy2c27f2uxhrm3r3unyya6ncjb4@cn7q5vdkjalv
Whole thread Raw
In response to Missing wait events (gap analysis)  (Nikolay Samokhvalov <nik@postgres.ai>)
List pgsql-hackers
Hi,

On 2025-11-21 18:43:31 -0600, Nikolay Samokhvalov wrote:
> Many tools that implement wait event analysis, when visualizing samples
> with "wait_event is null" use green color and "CPU" (perhaps, it started
> with RDS Performance Insights and PASH Viewer and, I suppose, originally
> came from the Oracle world, and now I see it in many more places).
> 
> I don't have any concerns with green color, but always had a feeling that
> "coalesce(wait_event, 'CPU')" is an assumption that can make analysis
> inaccurate, because there may be a lot of places in the code that are not
> covered by wait events, but technically should -- and such places cannot be
> named "CPU".
> 
> I asked Claude Code to analyze Postgres source code and find such places,
> that we could potentially cover with more wait events. Here is the first
> result:
>
https://github.com/NikolayS/postgres/blob/claude/cpu-asterisk-wait-events-01CyiYYMMcFMovuqPqLNcp8T/WAIT_EVENTS_ANALYSIS.md
> 
> Before moving forward with proposals of specific patches, I wanted to hear
> opinions -- does it make sense to work in this direction?

Some of this seems sensible.  However, I vehemently oppose turning wait events
into a poor emulation of a CPU profiler. I think it would lead us down a bad
path to add wait events for CPU activity. It'd just lead us to adding them
everywhere, ending up with wait events (CPU activity is not a wait!) having
significant costs.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: get rid of Pointer type, mostly
Next
From: Álvaro Herrera
Date:
Subject: Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY