From: zhouenbing <zhouenbing@sunwoda-evb.com>
To: 'Michael Paquier' <michael@paquier.xyz>
To: 'Greg Sabino Mullane' <htamfids@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: 答复: empty,query_id, pg_stat_activity
Date: Thu, 4 Sep 2025 11:32:18 +0800
Message-ID: <000b01dc1d4c$865eec00$931cc400$@sunwoda-evb.com> (raw)
In-Reply-To: <aLjcXPixsn8XltZv@paquier.xyz>
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>
<aLjcXPixsn8XltZv@paquier.xyz>
hello Michael
The application scenario for performing performance analysis on
Postgres through query_id is as follows:
First, monitor the events and query_ids of the active database sessions
during the current or past period by using the pg_stat_activity or
pg_active_session_history views to analyze performance issues. Then, quickly
locate the detailed execution information of the SQL statements by using the
query_id of the session SQL in the pg_stat_statements.
Aggregate and statistically analyze the performance of the SQL at different
time points in the past by aggregating in pg_stat_statements_history within
the specified time period.
However, at present, some active sessions in pg_stat_activity have empty
query_ids, which leads to many query_ids being empty in
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.
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: zhouenbing@sunwoda-evb.com, michael@paquier.xyz, htamfids@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: =?gb2312?B?tPC4tDogZW1wdHkscXVlcnlfaWQsIHBnX3N0YXRfYWN0aXZpdHk=?=
In-Reply-To: <000b01dc1d4c$865eec00$931cc400$@sunwoda-evb.com>
* 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