Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uu8TM-0031jt-4t for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Sep 2025 11:49:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uu8TL-00Fa3n-5F for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Sep 2025 11:49:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uu0ih-00CrD5-Kk for pgsql-bugs@lists.postgresql.org; Thu, 04 Sep 2025 03:33:08 +0000 Received: from zg8tmja5ljk3lje4ms43mwaa.icoremail.net ([209.97.181.73]) by magus.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1uu0iV-000SiJ-26 for pgsql-bugs@lists.postgresql.org; Thu, 04 Sep 2025 03:33:01 +0000 Received: from sunwoda-evb.com (unknown [119.146.89.130]) by hzbj-forward-1.icoremail.net (Coremail) with SMTP id AQAAfwC3gmJjCLloeokFAA--.8923S2; Thu, 04 Sep 2025 11:32:51 +0800 (CST) Received: from sunwoda-evb.com (unknown [172.27.103.90]) by mtasvr (Coremail) with SMTP id _____wAnSuFGCLloJ+sPAA--.28688S3; Thu, 04 Sep 2025 11:32:22 +0800 (CST) Received: from DL000951 (unknown [172.27.103.90]) by evbmailapp02 (Coremail) with SMTP id 3PEbrAC3hPJECLloOQ1MAA--.64099S2; Thu, 04 Sep 2025 11:32:22 +0800 (CST) From: "zhouenbing" To: "'Michael Paquier'" , "'Greg Sabino Mullane'" Cc: References: <000a01dc1beb$8837b910$98a72b30$@sunwoda-evb.com> <000201dc1c76$7d36e320$77a4a960$@sunwoda-evb.com> In-Reply-To: Subject: =?gb2312?B?tPC4tDogZW1wdHkscXVlcnlfaWQsIHBnX3N0YXRfYWN0aXZpdHk=?= Date: Thu, 4 Sep 2025 11:32:18 +0800 Message-ID: <000b01dc1d4c$865eec00$931cc400$@sunwoda-evb.com> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFeNHu8I9CKFzmMwCXXFbhYQqKGIQEfiG5cAahajloCC7FecALRWLwdtUEIcHA= Content-Language: zh-cn X-CM-TRANSID: 3PEbrAC3hPJECLloOQ1MAA--.64099S2 X-CM-SenderInfo: 52kr3vxqel0ww6vx045rgdgv1yeou0bp/ Authentication-Results: hzbj-forward-1.icoremail.net; spf=softfail smt p.mail=zhouenbing@sunwoda-evb.com; X-Coremail-Antispam: 1UD129KBjvdXoW7Xw4UAF4rCr4xtrWftr48Xrb_yoWkJrbEgF W0qrW8Xw17Ar4UKF4qkw15Xw4vg3yjkrWUGr4vgF42kr97trZxGws7KrW3uF4xWw45KrW3 trnxtw1UWr4vgjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb7xYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1IIY67AEw4v_Jr0_Jr4l 8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJV Cq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_ GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEnc xIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26Fy26r45twAv7VC2 z280aVAFwI0_GcC_XcWlOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMx02cV AKzwCY02Avz4vE14v_Gr4lc2IjII80xcxEwVAKI48JMxvI42IY6xIIjxv20xvE14v26r1j 6r1xMxvI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lcIIF0xvEx4A2jsIE14v26r1j6r 4UMxvI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UMxAIw28IcxkI7VAKI48JMxCjnVCFn7xv rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij64vIr41lIxAIcVCF04k2 6cxKx2IYs7xG6r1j6r1xYxBIdaVFxhVjvjDU0xZFpf9x07ji3kZUUUUU= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.