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 1vec6j-00FWxQ-2i for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Jan 2026 16:46:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vec6i-00APMY-14 for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Jan 2026 16:46:33 +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 1vec6i-00APMO-03 for pgsql-hackers@lists.postgresql.org; Sat, 10 Jan 2026 16:46:32 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vec6g-005jZp-1C for pgsql-hackers@postgresql.org; Sat, 10 Jan 2026 16:46:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 60AGkRnf2546767; Sat, 10 Jan 2026 11:46:28 -0500 From: Tom Lane To: jian he cc: PostgreSQL-development , Richard Guo Subject: Re: JumbleQuery ma treat different GROUP BY expr as the same In-reply-to: References: Comments: In-reply-to jian he message dated "Sat, 10 Jan 2026 21:13:39 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2546765.1768063587.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 10 Jan 2026 11:46:27 -0500 Message-ID: <2546766.1768063587@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk jian he writes: > explain(costs off, verbose) select count(*) from t group by a; > explain(costs off, verbose) select count(*) from t group by b; > explain(costs off, verbose) select count(*) from t group by c; > JumbleQuery will jumble Query->groupClause, but RangeTblEntry->groupexpr= s in > Query->rtable is marked with query_jumble_ignore and therefore excluded = from > jumbling. > So "group by a" and "group by" merged into the same entry in > pg_stat_statements, > Is this what we expected? It is not what happened before we invented RTE_GROUP. I tried your experiment in v14 and got: regression=3D# SELECT calls, rows, query FROM pg_stat_statements ORDER BY = query COLLATE "C"; calls | rows | query = = -------+------+-----------------------------------------------------------= ---- 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t 1 | 0 | explain(costs off, verbose) select count(*) from t group b= y a 1 | 0 | explain(costs off, verbose) select count(*) from t group b= y b 1 | 0 | explain(costs off, verbose) select count(*) from t group b= y c (4 rows) So I'm inclined to think this was an unintentional change of behavior. regards, tom lane