public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dominique Devienne <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: is pg_stat_activity "transactional"? How fast does it update?
Date: Wed, 11 Jun 2025 11:26:18 +0200
Message-ID: <CAFCRh-8twaDLV2uEy=R8e7U29LOAPhRN8vVzq712UE_J=7Ld4w@mail.gmail.com> (raw)
In-Reply-To: <CAFCRh--LyhHAOYKWE+NDCN8cB4pGiO82p1Ye9pT9T7fv7i2BfA@mail.gmail.com>
References: <CAFCRh-8WDkn2N+s43fofR4eKHcJC8fiotqWqSGkDQ4Sh4ZYwDg@mail.gmail.com>
	<[email protected]>
	<CAFCRh--LyhHAOYKWE+NDCN8cB4pGiO82p1Ye9pT9T7fv7i2BfA@mail.gmail.com>

On Tue, Jun 10, 2025 at 5:46 PM Dominique Devienne <[email protected]> wrote:
> On Tue, Jun 10, 2025 at 4:27 PM Tom Lane <[email protected]> wrote:
> > PQfinish is asynchronous: [...]
> > [...] pg_stat_activity() takes a snapshot of the view's contents
> Many thanks Tom. Didn't know either of those facts.

Hi. I ended up polling pg_stat_activity to wait for the disappearance
of the backend, to avoid the race in my unit tests. Initially
pg_stat_clear_snapshot() seemed to help, but then it didn't. Not
ideal, but I don't see any solution (work-around, really). There's a
new LOGIN event trigger, but no symmetrical FINISH one, and those are
restricted to privileged users, so useless in my case. Oh well. --DD






view thread (4+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: is pg_stat_activity "transactional"? How fast does it update?
  In-Reply-To: <CAFCRh-8twaDLV2uEy=R8e7U29LOAPhRN8vVzq712UE_J=7Ld4w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox