Re: empty,query_id, pg_stat_activity - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: empty,query_id, pg_stat_activity
Date
Msg-id aLjcXPixsn8XltZv@paquier.xyz
Whole thread Raw
In response to Re: empty,query_id, pg_stat_activity  (Greg Sabino Mullane <htamfids@gmail.com>)
Responses 答复: empty,query_id, pg_stat_activity
List pgsql-bugs
On Wed, Sep 03, 2025 at 04:54:27PM -0400, Greg Sabino Mullane wrote:
> The session is active, but there is no I/O yet, as the query has arrived,
> but has not been parsed yet. The queryid appears right before the query
> actually executes, so a lack of queryid is a safe indicator that the query
> is not actually doing any work yet- it's still spinning up. From a
> performance monitoring standpoint, you should be safe to exclude rows with
> no queryid.

Yeah, and there's likely no point in feeding the data of
pg_stat_activity to a CTAS, something that pg_stat_statements does for
most people these days.

FWIW, I use queries based on pg_stat_activity for monitoring purposes
in benchmarks to get aggregated values about wait events, to be able
to grab patterns, most of the time.  Filtering out query IDs would
lead to less information gathered.  You did not mention why
pg_stat_activity coupled with a query ID would be useful for you,
especially since we have a bunch of pgstats views that are able to get
aggregated data for the user, as well, to grab for bottlenecks, like
pg_stat_io, etc.
--
Michael

Attachment

pgsql-bugs by date:

Previous
From: Greg Sabino Mullane
Date:
Subject: Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore
Next
From: "zhouenbing"
Date:
Subject: 答复: empty,query_id, pg_stat_activity