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 1tirzv-003Cdn-OE for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Feb 2025 09:28:35 +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 1tirzt-006HKm-At for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Feb 2025 09:28:34 +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 1tirzt-006HKe-1G for pgsql-hackers@lists.postgresql.org; Fri, 14 Feb 2025 09:28:33 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tirzr-000mDG-0z for pgsql-hackers@postgresql.org; Fri, 14 Feb 2025 09:28:33 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-21f92258aa6so47949675ad.3 for ; Fri, 14 Feb 2025 01:28:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739525309; x=1740130109; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=fnII7PPUCZ01ow5WnUj46DBJBbkrdpv33T/ssNAShw8=; b=dDtZhJFutK3yV72vlUkCK8DRo/nOX6BWJHYVyyr7UDkGTK3qALpMJOELuoSvlJaKU0 snxRFIWdl7dQdpOIInzZrlslkYKJ6dHDQW0yr+iSvtlpPlCiB1Sah86l5g1B7SjkixyB 1i+e1nEleJx/O8deLJj3ij/74nWYj5hpiFKbQOg5KQqqRYLTdqSI3IGyd8IzBM2nCjXt ijc/dX5Q1NkcBj9oJ0P8X47h7ppw9E6PGw+STTPlyis08gPT+lBwzk49YQF1jScaBaQb Ii2/dhtmaymSZpNXRcLvqIQfqiymKXW+6b4SAi76ITcISCDhIqN94ZMGf5MsMS2Drro1 5HBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739525309; x=1740130109; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fnII7PPUCZ01ow5WnUj46DBJBbkrdpv33T/ssNAShw8=; b=LvTfTipvrenI8yRphw9AvwGHIIf3mc401DyAcSU1bonm2GY/ty3G1e1POm091tVUpk sGY0hOS4xt6284K95hE52LBKS/w81OWNaUdndxD+yxnPeUWBNHI3aoivrFGm+48Wn1Ag IFSkstVuppoEStGYNc3haKKO9j42toMpD/2skV/fiqtJGjNzIjYiWLrCc1+JrG1Ig8we x3kX6Mz8/mV6VelvhmWawDY4MZ1g9/lUw7MOOSyzp4hkHwpciLKAP8/CmSI2R9d54A5h FPINpLZyX1YBt5kDjfR6yYRBJTJimqtBuqbewsG5sO81PG2dV7zabe0JfzCyGd9POgrV i3QA== X-Forwarded-Encrypted: i=1; AJvYcCUEi/DkxGp2T6bNXVCI9dw8tt+NZD2AuvbgTE0fhQi0be9rUVZbIIFtX+BkCJW4qVMzNkohDi3W7D7UyU/p@postgresql.org X-Gm-Message-State: AOJu0YzqDSq3TvYCCUWnN9iQHSOMA9+f8osFJWCFGrIO9dO/posxa9xu bSxrLJCbNThUpMcGavDLBFNdubVG685YnSc1RRSnMigBBjTCKe4L X-Gm-Gg: ASbGncuORgulvHnMrgsD6O7W9tyRjF5qNJPDxeaJ56FvsQmlkDomi3UJ3o8L/qRdAsA IKm27YKqfl9lKNPbVbUr2JmxWau/jddoYfZAnwc59Cc/QliLk1PeONG6Q8ThfQxzC8vwP+kwcFO yCK9HdS7PSIamnojb9OLa2LMNgI0WIjdB6SulKjO8UFGR95v4gNJr3aIQqHh7OkSmY/qT9uCrAg q4jamko9yCfy0wYiu8VOYUq+ppFLybv5FTQCScaOTzsC2uGWe47zF/UKJIcEK++3ZBFTex8xuyi VVxOCsg= X-Google-Smtp-Source: AGHT+IHnXLOvAg3X/id4QkjcQBRTT2jszusHfbFcl2MeJazNjgirdV6KJReTg/Dtd+LXyIyR8/9M9Q== X-Received: by 2002:a05:6a00:1788:b0:730:91b8:af1 with SMTP id d2e1a72fcca58-7322c3e8957mr16455327b3a.18.1739525309353; Fri, 14 Feb 2025 01:28:29 -0800 (PST) Received: from jrouhaud ([115.43.41.38]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7324277be22sm2699631b3a.158.2025.02.14.01.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2025 01:28:28 -0800 (PST) Date: Fri, 14 Feb 2025 17:28:20 +0800 From: Julien Rouhaud To: Dmitry Dolgov <9erthalion6@gmail.com> Cc: Sami Imseih , =?iso-8859-1?Q?=C1lvaro?= Herrera , Kirill Reshke , Sergei Kornilov , yasuo.honda@gmail.com, tgl@sss.pgh.pa.us, smithpb2250@gmail.com, vignesh21@gmail.com, michael@paquier.xyz, nathandbossart@gmail.com, stark.cfm@gmail.com, geidav.pg@gmail.com, marcos@f10.com.br, robertmhaas@gmail.com, david@pgmasters.net, pgsql-hackers@postgresql.org, pavel.trukhanov@gmail.com, Sutou Kouhei Subject: Re: pg_stat_statements and "IN" conditions Message-ID: References: <202502131247.zls4jgcl2yqe@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Fri, Feb 14, 2025 at 09:36:08AM +0100, Dmitry Dolgov wrote: > > On Thu, Feb 13, 2025 at 05:08:45PM GMT, Sami Imseih wrote: > > This case with an array passed to aa function seems to cause a regression > > in pg_stat_statements query text. As you can see the text is incomplete. > > I've already mentioned that in the previous email. To reiterate, it's > not a functionality regression, but an incomplete representation of a > normalized query which turned out to be hard to change. While I'm > working on that, there is a suggestion that it's not a blocker. While talking about the normalized query text with this patch, I see that merged values are now represented like this, per the regression tests files: +SELECT query, calls FROM pg_stat_statements ORDER BY query COLLATE "C"; + query | calls +------------------------------------------------------+------- + SELECT * FROM test_merge_numeric WHERE data IN (...) | 1 + SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 +(2 rows) This was probably ok a few years back but pg 16 introduced a new GENERIC_PLAN option for EXPLAIN (3c05284d83b2) to be able to run EXPLAIN on a query extracted from pg_stat_statements (among other things). This feature would break the use case. Note that this is not a hypothetical need: I get very frequent reports on the PoWA project about the impossibility to get an EXPLAIN (we do have some code that tries to reinject the parameters from stored quals but we cannot always do it) that is used with the automatic index suggestion, and we planned to rely on EXPLAIN (GENERIC_PLAN) to have an always working solution. I suspect that other projects also rely on this option for similar features. Since the merging is a yes/no option (I think there used to be some discussions about having a threshold or some other fancy modes), maybe you could instead differentiate the merged version by have 2 constants rather than this "..." or something like that?