pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Greg Sabino Mullane <htamfids@gmail.com>
Cc: zhouenbing <zhouenbing@sunwoda-evb.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: empty,query_id, pg_stat_activity
Date: Thu, 4 Sep 2025 09:25:00 +0900
Message-ID: <aLjcXPixsn8XltZv@paquier.xyz> (raw)
In-Reply-To: <CAKAnmmL=dtnV5JxmrJNM=dFnQXRb6U3ah0E=bwxSD_+iDPv=ag@mail.gmail.com>
References: <000a01dc1beb$8837b910$98a72b30$@sunwoda-evb.com>
	<CAKAnmmKn9Q0Kw6qiQu1dvW1hkq0twOCsX4AO9=Xbk56cOh1aJw@mail.gmail.com>
	<000201dc1c76$7d36e320$77a4a960$@sunwoda-evb.com>
	<CAKAnmmL=dtnV5JxmrJNM=dFnQXRb6U3ah0E=bwxSD_+iDPv=ag@mail.gmail.com>

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

Attachments:

  [application/pgp-signature] signature.asc (832B, ../aLjcXPixsn8XltZv@paquier.xyz/2-signature.asc)
  download

view thread (6+ messages)  latest in thread

Message-ID: <aLjcXPixsn8XltZv@paquier.xyz>
Permalink:  ../aLjcXPixsn8XltZv@paquier.xyz/
Also on:    postgresql.org/message-id/aLjcXPixsn8XltZv@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, htamfids@gmail.com, zhouenbing@sunwoda-evb.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: empty,query_id, pg_stat_activity
  In-Reply-To: <aLjcXPixsn8XltZv@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox