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 1ronIO-003OQG-Va for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Mar 2024 16:35:37 +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 1ronIL-0063IS-Ex for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Mar 2024 16:35:33 +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 <9erthalion6@gmail.com>) id 1ronIL-0063IA-3E for pgsql-hackers@lists.postgresql.org; Mon, 25 Mar 2024 16:35:33 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) 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 1ronIH-006MeI-R2 for pgsql-hackers@postgresql.org; Mon, 25 Mar 2024 16:35:32 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5684db9147dso5304223a12.2 for ; Mon, 25 Mar 2024 09:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711384529; x=1711989329; 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=gSS2mNNdUh23mLTrXEPqzypBWTSSkFdyuUSPGwEK9ws=; b=ZQztokeqag/aD7LXhXu6jR4gbXa6lvRZREAcuN1BEej/dXxTCr4PEg2pM/ZDyk1YbF DUllkSOiwOFAgTtmrxIYdgZc/t6grmQeBLVsSP7UHyf2HFAZEuj3pCtLrHjjJ5NnWt2j rf3wFJU/9iENd6NPe4txIJDFi1aHhr3iJcxPBnqg08xC5SsQvR2UhF+rhTMFsfsl7/tf H3/46R5xRDibP6nwhsHkuJysoWZgCgmAp2eaXhMZE+EZgs4Qdz8WSSqLB1gtR5DiKyQR 8tR7K5UbwYCDLnFUXHi5/eRGrzULh0tpaU3iIB/UDZIaE2B96L8FX6ZKae3ZV0VaCU1z PJ8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711384529; x=1711989329; 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=gSS2mNNdUh23mLTrXEPqzypBWTSSkFdyuUSPGwEK9ws=; b=sfeJ+H6tkXwky6U7Jq44Bj9nZLDikowC0H9myM/HOCQJWHCx896z7vNteDOAnPhI+O QK8rVPEGHVsFd2ZiYvJ4A4SVjxc7j08T6Ch6HqF+oPYJkS911bFWrTyOqvsT/NU4YwPy n0WveAiEr2vJAV6t3+6bdttF1Mx+uHFqiTtBh6CAZ03iCigNnL4CpiyPqNG1zmqS3b4R 3gbPeKu1zwWh+rUC66HNCxzBP4RAXBmgTlhkyWZ7Kwq2P3Tf0MhllXisOt08yoh5na7/ ZLlIjK6H1CzIAHlvAvQn/4s5MqdYeg3nWly4bvExYbDULc5/XEp8GbBawdcklQBV+eWd +I7w== X-Forwarded-Encrypted: i=1; AJvYcCVOzTVvkPfwjkMPC/LfcO8pLT/Wmakdedds/Qjyl7Hr//DMxh1zc7b0052vxHtjyWGpzkhYTnmZMP5ohU1ahJgKt6xR2K1OZJtsIaJU X-Gm-Message-State: AOJu0YxAxwE+kIAALRMQRlTpnMJh5UXFlL1OrYyRTIA4moDqCZDwtytn Kfnt0Ke2mJkTnjdv+qzF5466FElFAU1S8Zs3WtIB3gU1gNqt8liM X-Google-Smtp-Source: AGHT+IFss/5tTBU9KmpbdDs+7GJcX6dr3250iiHu+deYBf0XNIL0xW0ekjti+MjXsS3Vnut26UcKuw== X-Received: by 2002:a50:9e44:0:b0:568:1248:9f49 with SMTP id z62-20020a509e44000000b0056812489f49mr4906196ede.18.1711384529303; Mon, 25 Mar 2024 09:35:29 -0700 (PDT) Received: from ddolgov.remote.csb (dslb-178-012-032-029.178.012.pools.vodafone-ip.de. [178.12.32.29]) by smtp.gmail.com with ESMTPSA id d25-20020a056402001900b0056c05e2596csm2192816edu.93.2024.03.25.09.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 09:35:28 -0700 (PDT) Date: Mon, 25 Mar 2024 17:35:27 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Yasuo Honda Cc: Tom Lane , Peter Smith , vignesh C , Michael Paquier , Nathan Bossart , "Gregory Stark (as CFM)" , David Geier , Sergei Kornilov , Alvaro Herrera , Marcos Pegoraro , Robert Haas , Zhihong Yu , David Steele , PostgreSQL-development , Pavel Trukhanov Subject: Re: pg_stat_statements and "IN" conditions Message-ID: <20240325163527.vphsig6jfawyo5tf@ddolgov.remote.csb> References: <20240108161020.pltnhlbtc7x32tj4@erthalion.local> <20240113140538.ifmkd7y2kvfnsj3w@erthalion.local> <20240122161123.tzau4pe6wp7h5vh2@erthalion.local> <3746172.1705941322@sss.pgh.pa.us> <20240122170727.6zcjobtvqz7z2cwp@ddolgov.remote.csb> <20240122210036.k55qagkrscfapwqb@erthalion.local> <20240323182026.2jksclhldwvk2hmh@ddolgov.remote.csb> 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 > On Sun, Mar 24, 2024 at 11:36:38PM +0900, Yasuo Honda wrote: > Thanks for the information. I can apply these 4 patches from > 0eb23285a2 . I tested this branch from Ruby on Rails and it gets some > unexpected behavior from my point of view. > Setting pg_stat_statements.query_id_const_merge_threshold = 5 does not > normalize sql queries whose number of in clauses exceeds 5. > > Here are test steps. > https://gist.github.com/yahonda/825ffccc4dcb58aa60e12ce33d25cd45#expected-behavior > > It would be appreciated if I can get my understanding correct. From what I understand out of the description this ruby script uses prepared statements, passing values as parameters, right? Unfortunately the current version of the patch doesn't handle that, it works with constants only [1]. The original incarnation of this feature was able to handle that, but the implementation was considered to be not suitable -- thus, to make some progress, it was left outside. The plan is, if everything goes fine at some point, to do a follow-up patch to handle Params and the rest. [1]: https://www.postgresql.org/message-id/20230211104707.grsicemegr7d3mgh%40erthalion.local