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 1tx79T-0034E8-Mm for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Mar 2025 16:29:19 +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 1tx79S-006Zny-2d for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Mar 2025 16:29:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tx79R-006Znq-0A for pgsql-hackers@lists.postgresql.org; Tue, 25 Mar 2025 16:29:17 +0000 Received: from mout-p-201.mailbox.org ([80.241.56.171]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tx79O-0014dc-1L for pgsql-hackers@lists.postgresql.org; Tue, 25 Mar 2025 16:29:15 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4ZMb325TMYz9tgt; Tue, 25 Mar 2025 17:29:02 +0100 (CET) Date: Tue, 25 Mar 2025 17:28:59 +0100 From: Christoph Berg To: pgsql-hackers@lists.postgresql.org Cc: =?iso-8859-1?Q?=C1lvaro?= Herrera , Sami Imseih , Michael Paquier , Tom Lane , Julien Rouhaud Subject: Squash constant lists in query jumbling by default Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 4ZMb325TMYz9tgt List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Re: Álvaro Herrera > Introduce squashing of constant lists in query jumbling > > pg_stat_statements produces multiple entries for queries like > SELECT something FROM table WHERE col IN (1, 2, 3, ...) > > depending on the number of parameters, because every element of > ArrayExpr is individually jumbled. Most of the time that's undesirable, > especially if the list becomes too large. > > Fix this by introducing a new GUC query_id_squash_values which modifies > the node jumbling code to only consider the first and last element of a > list of constants, rather than each list element individually. This > affects both the query_id generated by query jumbling, as well as > pg_stat_statements query normalization so that it suppresses printing of > the individual elements of such a list. > > The default value is off, meaning the previous behavior is maintained. The "jumble names of temp tables" thread was briefly touching this [1], I'm starting a new thread since the others are already very long. [1] https://www.postgresql.org/message-id/flat/CAA5RZ0uNofEXfEfNw3uRN3D3oXkFPQ_s%2BhuLLHMKR_%2BMCk8RPQ%40mail.gmail.com#c357c56c3924642e8ef73cc1c8a0286e Two points were made: 1) this should be on by default 2) there should be no GUC for it. For 1), Sami said "Why would anyone not want to squash the IN list?" to which I can only agree. Michael agreed as well, that's already +3. For 2), Tom said that configurability is 1) often much less useful than originally planned, and 2) tools have to cope with both settings anyway, making implementing them harder. Plus, switching at run-time makes the result even less predictable. So, I would propose that we drop the GUC and make it the default. Opinions? Christoph