Re: empty,query_id, pg_stat_activity
Greg Sabino Mullane <htamfids@gmail.com>
From: Greg Sabino Mullane <htamfids@gmail.com>
To: zhouenbing <zhouenbing@sunwoda-evb.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-09-02T15:11:01Z
Lists: pgsql-bugs
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