Thread
-
Re: empty,query_id, pg_stat_activity
Greg Sabino Mullane <htamfids@gmail.com> — 2025-09-02T15:11:01Z
If the query_id* is null, it is not actually running yet. This is a good thing as far as your stated tracking requirements. You can do a WHERE query_id IS NOT NULL to exclude statements where the query has appeared, but has not been parsed and executed yet. I daresay you also want to be looking at wait_event and now()-state_change as well. Cheers, Greg * Actually, query_id some places, queryid in others. So annoying. -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & Tech Support