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 1utxmu-00HAXk-2f for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Sep 2025 00:25:17 +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 1utxmt-00CLDG-8j for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Sep 2025 00:25:15 +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 1utxmt-00CLD8-0Y for pgsql-bugs@lists.postgresql.org; Thu, 04 Sep 2025 00:25:15 +0000 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1utxmp-000RId-2O for pgsql-bugs@lists.postgresql.org; Thu, 04 Sep 2025 00:25:14 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id 87A0A1D0022B; Wed, 3 Sep 2025 20:25:10 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Wed, 03 Sep 2025 20:25:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1756945510; x=1757031910; bh=avxZE+gETl DhcycNSQz5uweUK+onTsVfczu8Bq4ODc8=; b=b/slnntMZvFw7U/SKtpOaLCWzC mE9pDIhPOiceu8TSbntHE+at+Ggbh6g4pVWVs7zUY7MTS31A2YtbH4K5RtjyRooW wQxxQFoepW7qQy2H0Ah4O8eRRaXf8YTyxot17GQTblj53d4yV3LkW9eayDtQDWG0 CFUAvwAY3EwDJj5vwGq2oPUBh+gq6OzLNunRuapk9nXW9kNipTXLTxX+4Nsz62v2 7QyBQurSNQXbsDZVUagxMytag91xWHvANk9MmcX8C1DPpuZSYc0mxmpTVqt4j9TV t+3fnoM2P5SKiA7YC6tVea6T7Ym9rWXAyg1irkqGCL+Sb8xjDBPBCQXqI4sA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1756945510; x=1757031910; bh=avxZE+gETlDhcycNSQz5uweUK+onTsVfczu 8Bq4ODc8=; b=UWDoiAi7cE9Tlazux8G5F6C7qyYePcwYYUjmBaAhLnAAp+rjN1A Co6IPLllQJWjR6BHPSkbZEE6srfuwIxS52TsplDuBjgazIlJw1cGxPiQqq/Y7GTV ahrMJebkB4zJMgdLY351AToU4jKsSt77XHWUgUYDWehTAr3MIWIwb6j0EfbTFAiC ftH0UTKBmClA3/MUT+Enh2QlbQvUSKbBTAYWK8oXCDd47kjOMAqpzyX6DlcQ7iAV zCkzkpPM8n7/ttEyPLmeMeDhjYBeaDKpdH8W3B2b/2+QyTLm2hnE9WIwEMRcYcA8 KcUjcGtqGv4hRM9GOc3W18JjRv1K+PvahGA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdegheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukf hfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghr uceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepte elieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlh esphgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohephhhtrghmfhhiughssehgmhgrihhlrdgtohhmpdhrtghpthhtoh epiihhohhuvghnsghinhhgsehsuhhnfihouggrqdgvvhgsrdgtohhmpdhrtghpthhtohep phhgshhqlhdqsghughhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Sep 2025 20:25:08 -0400 (EDT) Date: Thu, 4 Sep 2025 09:25:00 +0900 From: Michael Paquier To: Greg Sabino Mullane Cc: zhouenbing , pgsql-bugs@lists.postgresql.org Subject: Re: empty,query_id, pg_stat_activity Message-ID: References: <000a01dc1beb$8837b910$98a72b30$@sunwoda-evb.com> <000201dc1c76$7d36e320$77a4a960$@sunwoda-evb.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="S1n7bqj9JrK+C9IX" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --S1n7bqj9JrK+C9IX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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,=20 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 --S1n7bqj9JrK+C9IX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmi43FwACgkQnvQgOdby QH3Oug/+KT9LB+jgen+zqhGsj73TskWiIUw/H3UwyFREKw6WArLoIX9TaufRihQg 5Wfs877vAapzaDWS2qxLWmr4Q3QOXKWP9DetD6cM+4Mqh+l6NnyjGpMZa4aFEoTV Xi6oSSTeotIK/2nY199IdTmRHlbz5aiaN1DkKUGOxCCKyy5SMXskUGyzsGpbByPh W02RyGB938ItEfigG5LB/RuT5SvNFA7MAH3Z137rgq0rwZdTAhmugFMEy9ruP6u+ 1WBXbV3xkjYdO92EVubzshTuUcvpAzxZ7cCqct4cuEn/+M0rNr4y7xxcS575nYCn 0alleCnn24BRrpigFJhrYy5ZThd0cPFY5//SV4lqX3NDiYR2pzAnreZxkiCyDU7Q A9vXLpcwkXc19lJ3BeasZCGZD0KqVJGpkGAqTisJdhAigK4odoAnLYhw93+JLY35 fC6qyQbaye3vcuBuyJ2Wsmus41eJjBGjmpoNVEfrlCQK35XuuqY5pRD6vT0+b3+m N97NRNcz1xRDzuzViEhheTQjDshj8xMqyAkMaAwx/BXhoxbKG8YJ8XWw/rfbrKVe nhQzGRQBKds4/zFqUNeA4s798UjYJ7L5rNTOYM32k6D1de0giszGdNfrxV3rDeYz yIhotPCQcSJ2qpvXd5OW26OrHXHb9jgMnSmdwOhiVXxw7Yc5qe4= =UGfI -----END PGP SIGNATURE----- --S1n7bqj9JrK+C9IX--