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 1pQ8Ri-0004rg-JF for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Feb 2023 15:02:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQ8Rg-0006zg-Nv for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Feb 2023 15:02:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1pQ8Rg-0006xK-CX for pgsql-hackers@lists.postgresql.org; Thu, 09 Feb 2023 15:02:44 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1pQ8Re-0004i5-4x for pgsql-hackers@postgresql.org; Thu, 09 Feb 2023 15:02:43 +0000 Received: by mail-ej1-x632.google.com with SMTP id qb15so5121711ejc.1 for ; Thu, 09 Feb 2023 07:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=oRcU3soE1QFHysqT4xi3bwq98q8e0viML+2qUBhMqoc=; b=BH8NpFMRSyQh1lyvp0Mi5AnCdGZKzLiSxVegzTbAKzRhihj3ZOtZie40t1luVGkOsQ 9wLaTYCT9GRooDvw/jpQlVO+DLLpAsUSBC6DTjds3Uh2tmxbYYB8ij9Vduc4JP3T7GIs 0MIL039268dw1LiygpyAUmZtehlZFa7vTAafFjCBfbiXCW/gdhnkH6ri3CtaSQfF4GNE p6Li7aOt4w3cKWzPF89MFH+GIABeOJq7axxW+tFb+s2mK26TqOgnLB1MFO3JjLAKI7J3 14e7auKtK3ysWEgnRcL0nbgXLFvGIC9BGpCxtlC7lppBYYW/+lqZPqwRHoEm062jdu2g ruzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=oRcU3soE1QFHysqT4xi3bwq98q8e0viML+2qUBhMqoc=; b=zbDOkp+rUr6cJ/N8dGHpuiD4Nl3CzRlR4x3Cqh4JmzRvETG7NNIa7eyZzw8jFj69Rd qQjXXo9W/Ugu1e0I+bpoPuu+hXgZBeacWGZ9MVFqZwsVobztPbH1Z1j31kdajBzBjZgw eN4ASHatgteDhuITRUMMMwa00Bw4ySCqRMnQOH8SgJzKIMiOUs+0zK8aDTSvvhGDXlJa lziHAKZEchScPzwRdPm48g7np9vr1zUd5Sob0uv4bjKbekg4TR+2GDFJVu9O9XAc2eDu lzm8krRyvFOkFCzPIm8NHUJA/BrSC2qA7TyjX9TAEL9jSfceqaBha1Bnzuj8HlhmUyvt dbtA== X-Gm-Message-State: AO0yUKU9tELfOKgPci1CWc5u2MzWRkUd1gvCU6C73zy79x7pyBhPo/gB 9zZep6utZbo94rULPWuACdc= X-Google-Smtp-Source: AK7set8yDFX7tW0ul/6bgaNoZuzxckqvsZ5wh/35y90wQClc5Qtvbcm+wYCWd16YHDlCJ4B4v0WjQw== X-Received: by 2002:a17:906:34d9:b0:8af:2f5e:93e3 with SMTP id h25-20020a17090634d900b008af2f5e93e3mr3465996ejb.29.1675954960736; Thu, 09 Feb 2023 07:02:40 -0800 (PST) Received: from ddolgov.remote.csb (dslb-178-012-041-046.178.012.pools.vodafone-ip.de. [178.12.41.46]) by smtp.gmail.com with ESMTPSA id f20-20020a170906739400b00857c2c29553sm966629ejl.197.2023.02.09.07.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 07:02:39 -0800 (PST) Date: Thu, 9 Feb 2023 16:02:38 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Sergei Kornilov Cc: Michael Paquier , Alvaro Herrera , Marcos Pegoraro , vignesh C , Robert Haas , Zhihong Yu , David Steele , PostgreSQL-development , Greg Stark , Pavel Trukhanov , Tom Lane Subject: Re: pg_stat_statements and "IN" conditions Message-ID: <20230209150238.rdtwruh5i34hdag5@ddolgov.remote.csb> References: <20230129133219.tpuzqbyqw3ojztbd@erthalion.local> <20230202140727.g7tw7qjo43g54wcb@alvherre.pgsql> <20230202150554.dwxhvw23epcskppb@ddolgov.remote.csb> <20230204170841.xfgxoo7ymwbvu7yx@erthalion.local> <20230205113346.gmbf5ycnukuhnmqa@erthalion.local> <2420105.1675612952@sss.pgh.pa.us> <20230205195600.e3bhwszzm5kdyyxl@erthalion.local> <966631675800892@znolar4klagewshm.sas.yp-c.yandex.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <966631675800892@znolar4klagewshm.sas.yp-c.yandex.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Tue, Feb 07, 2023 at 11:14:52PM +0300, Sergei Kornilov wrote: > Hello! Thanks for reviewing. > Unfortunately, rebase is needed again due to recent changes in queryjumblefuncs ( 9ba37b2cb6a174b37fc51d0649ef73e56eae27fc ) Yep, my favourite game, rebaseball. Will post a new version soon, after figuring out all the recent questions. > It seems a little strange to me that with const_merge_threshold = 1, such a test case gives the same result as with const_merge_threshold = 2 > > select pg_stat_statements_reset(); > set const_merge_threshold to 1; > select * from test where i in (1,2,3); > select * from test where i in (1,2); > select * from test where i in (1); > select query, calls from pg_stat_statements order by query; > > query | calls > -------------------------------------+------- > select * from test where i in (...) | 2 > select * from test where i in ($1) | 1 > > Probably const_merge_threshold = 1 should produce only "i in (...)"? Well, it's not intentional, probably I need to be more careful with off-by-one. Although I agree to a certain extent with Peter questioning the value of having numerical option here, let me think about this. > const_merge_threshold is "the minimal length of an array" (more or equal) or "array .. length is larger than" (not equals)? I think the documentation is ambiguous in this regard. > > I also noticed a typo in guc_tables.c: "Sets the minimal numer of constants in an array" -> number Yep, I'll rephrase the documentation.