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: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: empty,query_id, pg_stat_activity
Date: 2025-09-04 12:56:05
Message-ID: CAKAnmmJH=0jdNB+ujGJS1w=ZLFCtw1DEZ49uQ1HWd1m_C=NYOQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Sep 3, 2025 at 11:32 PM zhouenbing <zhouenbing(at)sunwoda-evb(dot)com>
wrote:

> pg_active_session_history as well. If Mr. Greg said that empty query_ids
> indicate that the session SQL has not been executed, then I will exclude
> the
> sessions with empty query_ids. But I think that if the SQL has not been
> executed, the session status should be 'inactive' instead.
>

I understand your point, but "active" for pg_stat_activity means it is
alive and doing something - just not what you are expecting in this case.
We are not going to add a new status, or change it to inactive. You can
think of the status you want (actively executing a query) as being
indicated by the combination of state=active and queryid not null.

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-09-04 15:24:58 Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own
Previous Message Yushu Chen 2025-09-04 09:03:34 Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own