Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qGlIr-0000Ej-Pb for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Jul 2023 19:03:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qGlIq-0007je-Ju for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Jul 2023 19:03:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1qGlIq-0007jV-AQ for pgsql-hackers@lists.postgresql.org; Tue, 04 Jul 2023 19:03:08 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from <9erthalion6@gmail.com>) id 1qGlIj-0022Ku-IR for pgsql-hackers@postgresql.org; Tue, 04 Jul 2023 19:03:07 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-313f61890fbso6401091f8f.3 for ; Tue, 04 Jul 2023 12:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688497379; x=1691089379; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=00hahQ6nhD4Pn9S/3vAbLFyxIPWLuX2MeAgtRpHRL1g=; b=i0SSaAdspZPugBL2zWV2uxlW8c0s1Kk6UDy8pFjc87nqfWdbdytrvViFBsxp++qsBX BQLGJIX4DWfyXzitCIqQaJaI/8A6J08cKIbeRGfwRlO9kjoffeIWmx/Vcv58vX9oCRZd nPSogB9Mt/8YIXrFP41ohapxAoyCuupdzZdoJ7Nv3By1XzAyrQYuRt9H8oNysSJF+CtQ GPSeIx4UdUEdLqMM655K/P+zXNfEPOOUpiCKY82WEsz6V+SEgbxRHK4pngTXZv8bU1kM FG9RlUzzjObVegcMM6VSlPcrj6toPYV7KFFsJUAicxgWXNCL68F4NL24j9s6FlGCHlWe VeIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688497379; x=1691089379; h=in-reply-to:content-transfer-encoding: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=00hahQ6nhD4Pn9S/3vAbLFyxIPWLuX2MeAgtRpHRL1g=; b=Hk8ShB8SE0tauxtCWkE35Z5EC96gLT1jaZSDU+Hum7QHX5Yjx1cqTh9RPy3cOnLof/ BzDQpbLTKLdkwBqlrLz09y4VGhXDt8IrZ0+/D/H0S0uYWKUPJgApSOGf+nI7xXIuAz1f kLPwbUBJVAILjJkZja0rMhKv6aMDsTP3/TpXTbHcmdve+vpCtZRKlTKimQdALolSbEV2 WuK0XgEjympvrh9JWLq58SoKszn5EibOlRYc9P5uboESvprb1vPNPMy0GAVSmGHgy3/z EnbSfQ31OO/cG8DUgSIxufpcLnikazQwbweiIOJFkV2+xIhYJBXVzSxfekcUPUWBIt6p KIiQ== X-Gm-Message-State: ABy/qLYXnT1ekl0X3uhamxl8ZaebVwMgM/jO7jZ3nU1eVNgE90XfBNNi fG5XXCLjyeaPfMTsmHK+skY= X-Google-Smtp-Source: APBJJlEsTZdNYoqLQhSjcP+eMZj4zx0EQxC3RH12+Jax8224sjBFLPwKij2XgMNLJUmgwe7i8LDXNQ== X-Received: by 2002:adf:dd89:0:b0:314:1b36:f440 with SMTP id x9-20020adfdd89000000b003141b36f440mr10044020wrl.70.1688497379031; Tue, 04 Jul 2023 12:02:59 -0700 (PDT) Received: from ddolgov.remote.csb (dslb-178-005-234-222.178.005.pools.vodafone-ip.de. [178.5.234.222]) by smtp.gmail.com with ESMTPSA id d10-20020adfe2ca000000b0031272fced4dsm29217596wrj.52.2023.07.04.12.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 12:02:58 -0700 (PDT) Date: Tue, 4 Jul 2023 21:02:56 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Nathan Bossart Cc: "Gregory Stark (as CFM)" , David Geier , Sergei Kornilov , Michael Paquier , Alvaro Herrera , Marcos Pegoraro , vignesh C , Robert Haas , Zhihong Yu , David Steele , PostgreSQL-development , Pavel Trukhanov , Tom Lane Subject: Re: pg_stat_statements and "IN" conditions Message-ID: <20230704190256.arszjcwvrjekxj25@ddolgov.remote.csb> References: <20230211104707.grsicemegr7d3mgh@erthalion.local> <20230211120820.y7krq37jubnjsa5b@erthalion.local> <07919318-6c35-a13f-6a1d-98686a3e38de@gmail.com> <20230217154602.uf3a3cgqeoeysycz@erthalion.local> <8702fa3e-5aac-dcf0-161b-faa2b9eadad6@gmail.com> <20230226104619.jfmwrpd5zrkmp3eu@erthalion.local> <20230314190432.l4oe3wa3pvt5b7hx@erthalion.local> <20230319122734.xkba536kut3g4gcy@erthalion.local> <20230704044611.GA3373000@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230704044611.GA3373000@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Mon, Jul 03, 2023 at 09:46:11PM -0700, Nathan Bossart wrote: Thanks for reviewing. > On Sun, Mar 19, 2023 at 01:27:34PM +0100, Dmitry Dolgov wrote: > > + If this parameter is on, two queries with an array will get the same > > + query identifier if the only difference between them is the number of > > + constants, both numbers is of the same order of magnitude and greater or > > + equal 10 (so the order of magnitude is greather than 1, it is not worth > > + the efforts otherwise). > > IMHO this adds way too much complexity to something that most users would > expect to be an on/off switch. This documentation is exclusively to be precise about how does it work. Users don't have to worry about all this, and pretty much turn it on/off, as you've described. I agree though, I could probably write this text a bit differently. > If I understand Álvaro's suggestion [0] correctly, he's saying that in > addition to allowing "on" and "off", it might be worth allowing > something like "powers" to yield roughly the behavior described above. > I don't think he's suggesting that this "powers" behavior should be > the only available option. Independently of what Álvaro was suggesting, I find the "powers" approach more suitable, because it answers my own concerns about the previous implementation. Having "on"/"off" values means we would have to scratch heads coming up with a one-size-fit-all default value, or to introduce another option for the actual cut-off threshold. I would like to avoid both of those options, that's why I went with "powers" only. > Also, it seems counterintuitive that queries with fewer than 10 > constants are not merged. Why? What would be your intuition using this feature? > In the interest of moving this patch forward, I would suggest making it a > simple on/off switch in 0002 and moving the "powers" functionality to a new > 0003 patch. I think separating out the core part of this feature might > help reviewers. As you can see, I got distracted by the complicated > threshold logic and ended up focusing my first round of review there. I would disagree. As I've described above, to me "powers" seems to be a better fit, and the complicated logic is in fact reusing one already existing function. Do those arguments sound convincing to you?