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.96) (envelope-from ) id 1vesRZ-001MK9-0D for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Jan 2026 10:13:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vesRY-00BePY-00 for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Jan 2026 10:13:08 +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.96) (envelope-from ) id 1vesRX-00BePP-0L for pgsql-hackers@lists.postgresql.org; Sun, 11 Jan 2026 10:13:08 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vesRU-005z68-2H for pgsql-hackers@postgresql.org; Sun, 11 Jan 2026 10:13:07 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 4C39B1D000A9; Sun, 11 Jan 2026 05:13:02 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Sun, 11 Jan 2026 05:13:02 -0500 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=fm2; t=1768126382; x=1768212782; bh=PeTYd0uNym +bCAluCBT3ekRZy6fSvtjZ0n3pOTdYmyg=; b=hw/v/Zs/QYDsbkBaL+w3Xq+gBF Mls51N4ZJp8ZPbIDXfO95bbyJ8SsIrinXg9CoeQA+fYF2HcZh3/WjQQV9I9jKwAu AzSJfcPGmNPhrhUYN0r8hHhbKHM8PSgDz1y4nfldtIk0Y4WPIiFZ/Up5eWPvsRqp w1WQ+hBm97Qvke72WB3N7HAHkqoJXgHBQ9cbTwbYBbOYTGd0/vlDEoHwpqkVB08B F9QI4MdyWE5vpmBnU2RXxfBr1iha+QLU8rgIn5aC1hb888Q0/+p7esQQCe70uqvF PVOOzJvJwlI6czjByeEZKY4/ZaTq2yb9t/SL0X9ldDTMlkMXmW/+Rlt1WyuA== 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=fm2; t= 1768126382; x=1768212782; bh=PeTYd0uNym+bCAluCBT3ekRZy6fSvtjZ0n3 pOTdYmyg=; b=PHRZo/jBhICw37pPw5W+NTSPt9xYIFIOCzoyNcTmupgz8RYHIZg fIX81ZyK+nDsPUfPY6ZPpjl2gRZxSynxiBY9xLZKKy05Fs7RL/RSkunYxQ6E5XFm HZ6Yy461BIpcmd3guXiM95D5rrk158SmdkxDS45ipgm0MOgLp6sTq4Jd1Ejt4KdG 5YiNAALjwxurkz0wSZ2CqAsVQYHcQ0aTNKzM8RnynCpb4mGxpE8EwMm4ODcq/PiO PVg+X1vWFE7Qe4HV3CG6gROFb6vbdaMKGZV36te1jaOqf8euHFkA4yGKsad0PrI2 F7a0hmq+J8NMQjSoaFCGYJesntlKzbfm+eg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduudegfedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvve fukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhi vghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnh epteelieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrg gvlhesphgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepgedpmhhouggvpehsmhht phhouhhtpdhrtghpthhtohepthhglhesshhsshdrphhghhdrphgrrdhushdprhgtphhtth hopehjihgrnhdruhhnihhvvghrshgrlhhithihsehgmhgrihhlrdgtohhmpdhrtghpthht ohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpth htohepghhuohhfvghnghhlihhnuhigsehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 11 Jan 2026 05:12:59 -0500 (EST) Date: Sun, 11 Jan 2026 19:12:46 +0900 From: Michael Paquier To: Tom Lane Cc: jian he , PostgreSQL-development , Richard Guo Subject: Re: JumbleQuery ma treat different GROUP BY expr as the same Message-ID: References: <2546766.1768063587@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rOFF+Lo5zMi/lRFD" Content-Disposition: inline In-Reply-To: <2546766.1768063587@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --rOFF+Lo5zMi/lRFD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 10, 2026 at 11:46:27AM -0500, Tom Lane wrote: > It is not what happened before we invented RTE_GROUP. I tried your > experiment in v14 and got: >=20 > regression=3D# SELECT calls, rows, query FROM pg_stat_statements ORDER BY= query COLLATE "C"; > calls | rows | query = =20 > -------+------+----------------------------------------------------------= ----- > 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t > 1 | 0 | explain(costs off, verbose) select count(*) from t group = by a > 1 | 0 | explain(costs off, verbose) select count(*) from t group = by b > 1 | 0 | explain(costs off, verbose) select count(*) from t group = by c > (4 rows) >=20 > So I'm inclined to think this was an unintentional change of behavior. The difference of behavior is between v17 and v18, as an effect of 247dea89f761. I know that we should not break query ID computations in stable branches, but v18 is very recent and we still have many years to support it.. So I would like to suggest that we make an exception and backpatch a fix to v18. This behavior is not cool for users. This issue also points to a gap in the regression of pg_stat_statements, where we have never bothered testing patterns of GROUP BY with the same table and different attributes. Jian, would you like to write a patch? -- Michael --rOFF+Lo5zMi/lRFD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmljd54ACgkQnvQgOdby QH0P7Q/+OEAYCmF5sUJ2MYinhiYLli3uI7W0PlfvTV4YxpPi7MdRLZrJb3zu9QzX dDltd8tRFBkcT3X+fXCIM6MdC3qngoLH1nV1FVdr6x62tSxZBqMgxsWxqr6Hi74z HTay7ePo1AESLhUpX7rN8+qlqWAjt5WMJsOsC59URLGZZ4WAo9V3790m0GgwdtKD Nby5uVZX9MVSibgB+YWGz3XFpwtyQntce0XRlNi6RODczOfRaH5/NH+WXX366Ra5 TLhDsoRKcrbqgTK+Ec8hFX0fsydQn9RnFzSvSVL9D4OsuDz9D2KQcQ54mLnbkADY ilp+1nIxQhad4uK7DbtlmVsRAXqpFFodRj1nouKoVqxQfmdPm1CfxpDMg5pNbmHY M07lXiJfnkZHJdQBgIKv4SQ5S57DqZZ0gCPLmhKaDjXZHoxlOpWCnmskJKp65XNW 4og1bKoXCVZ8congpcxULWbI9KAeczwe/o4WiD/nOdGxWlSMNEvUrPtfQy9d2kU8 Jc9C7exPmQKuf+N3fzDxNd+GO5SZy9hSy1OOEfUF320O3Cn0lZ3wA8GqmU50evR4 7sK7qiY9YDDUOn/Regd3aaBEqPY55f7V4zr5btavv9SY0tLFx52dHE51AkAIOBYw 4JqJlUEdEFgSz1NJpBfVe1XvVqioDZ5keZgCVkTXtdXoiypdbfg= =5wxF -----END PGP SIGNATURE----- --rOFF+Lo5zMi/lRFD--