Re: Fix pg_stat_get_backend_wait_event() for aux processes

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Sami Imseih <samimseih@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Robert Haas <robertmhaas@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2026-02-05T16:58:41Z
Lists: pgsql-hackers
Hi,

On 2026-02-04 17:48:57 -0600, Sami Imseih wrote:
> >
> > There is also a discussion [0] about wait event/activity field
> > inconsistency
> > with pg_stat_activity with a repro in [1].
> 
> 
> The repro I was referring to in [1] is actually
> https://www.postgresql.org/message-id/ab1c0a7d-e789-5ef5-1180-42708ac6fe2d%40postgrespro.ru

That is inherent. The wait event is updated in an unsynchronized fashion. As
noted in that thread.

Making it synchronized (via st_changecount) would make wait event overhead
vastly higher.

Greetings,

Andres Freund



Commits

  1. Fix pg_stat_get_backend_wait_event() for aux processes

  2. doc: Mention possible ephemeral discrepancies in pg_stat_activity

  3. Show more processes in pg_stat_activity.