Re: empty,query_id, pg_stat_activity

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: zhouenbing <zhouenbing(at)sunwoda-evb(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: empty,query_id, pg_stat_activity
Date: 2025-09-02 15:11:01
Message-ID: CAKAnmmKn9Q0Kw6qiQu1dvW1hkq0twOCsX4AO9=Xbk56cOh1aJw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-09-02 15:27:15 Re: BUG #19037: Planner fails on estimating array length with "no relation entry" error
Previous Message Maxim Michkov 2025-09-02 14:12:14 Re: BUG #18575: Sometimes pg_rewind mistakenly assumes that nothing needs to be done.