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 1rhNO0-00B8Wa-8L for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Mar 2024 05:30:45 +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 1rhNNy-00DdS4-JS for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Mar 2024 05:30:43 +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 1rhNNy-00DdRu-6B for pgsql-hackers@lists.postgresql.org; Tue, 05 Mar 2024 05:30:42 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhNNo-002q6h-TC for pgsql-hackers@postgresql.org; Tue, 05 Mar 2024 05:30:39 +0000 Received: from [172.30.8.38] (unknown [172.30.8.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.lepikhov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 3AB69E20E7F; Tue, 5 Mar 2024 08:30:28 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1709616631; bh=F4x8b48OekavmQiWJdo0LJv9FTWo1M4n0MrWH3L9fEU=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=hi8fv9S1ltYrLKi/GVwjU+MSniF+4nz7f7zbrZyfVpG6GkW+oABJS2/omYxZTHL/T T/gOKOtoohbEDPb/GqlsjUZRQF2TFlGgUsXu/J/jCgFJ7vsjPAD2LC9tTLh36XxZdC Gvk4OUkhyyZLbeFMU2BPWCr9oF4uLkPe9IqjF6J8QGeHDSeSdIiBkjSu1eCNeXYQsE hZywKCKsQah2LQqWYaHnr749ugliCBHtNiCvUjFjoEZ25bzSjNI9deV8KVd76yqruI ofwsybRgthhc18GUGtf9+WXY3591SoWENOqW7Hd2edNOVuxGujfXi2pW3Nyk6i29lj Ty8nkcGdFLsTA== Message-ID: Date: Tue, 5 Mar 2024 12:30:25 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: POC, WIP: OR-clause support for indexes Content-Language: en-US To: jian he Cc: Alena Rybakina , Alexander Korotkov , Robert Haas , pgsql-hackers@postgresql.org, Peter Geoghegan , "Finnerty, Jim" , Marcos Pegoraro , teodor@sigaev.ru, Tomas Vondra , Peter Eisentraut , Ranier Vilela References: <567ED6CA.2040504@sigaev.ru> <1cf6b382-6e27-4268-9f2a-54ada66eb2eb@postgrespro.ru> <5f119769-ab11-4807-abcc-71d5dd914ea0@postgrespro.ru> <21088129-7cd3-424a-bcce-6a3427ba3276@postgrespro.ru> <11ee9c04-281f-43c8-a0ff-d481c1e01c09@postgrespro.ru> <54009ba5-4aea-4344-a30d-e3558a59e2a9@postgrespro.ru> <380e5683-cdfd-4220-ab9b-7cccb9d3e480@postgrespro.ru> From: Andrei Lepikhov Organization: Postgres Professional In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/3/2024 09:26, jian he wrote: > On Thu, Feb 29, 2024 at 4:59 PM Andrei Lepikhov >> Feel free to add, change or totally rewrite these changes. On replacement of static ScalarArrayOpExpr dest with dynamic allocated one: After discussion [1] I agree with that replacement. Some style (and language) changes in comments I haven't applied because it looks debatable for me. > I think it should be something like: > + gettext_noop("Transform a sequence of OR expressions to an array > expression."), > + gettext_noop("The planner will replace expression like 'x=c1 OR x=c2 " > + "to the expression 'x = ANY( ARRAY[c1,c2])''" Fixed > queryId may not be a good variable name here? Not sure. QueryId is a concept, part of queryjumble technique and can be used by other tools. It just tells the developer what it is the same thing as Query Jumbling but for a separate expression. At least you don't insist on removing of JumbleState return pointer that looks strange for a simple hash ... > > comment `/* Compute query ID */` > seems not correct, here we are just hashing the expression? The same as above. > +/* > + * Dynahash match function to use in guc_hashtab > the above comments seem not correct? Yes, fixed. > ` It applies to equality expressions only.` seems not correct? > `select * from tenk1 where unique1 < 1 or unique1 < 2; ` can also do > the transformation. Yes, I forgot it. > `similarity of variable sides.` seems not correct, > should it be 'sameness of the variable sides`? The term 'equivalence' looks better *). > in [2], we can get: > SOME is a synonym for ANY. IN is equivalent to = ANY. > > but still transforming OR to ANY is not intuitive. > a normal user may not know what is "transforming OR to ANY". > so maybe adding a simple example at > xreflabel="enable_or_transformation"> > would be great. which, I did at previous thread. Not sure. Examples in that section are unusual things. What's more, should a user who doesn't know what it means to change this setting? Let's wait for other opinions. [1] https://www.postgresql.org/message-id/2157387.1709068790@sss.pgh.pa.us -- regards, Andrei Lepikhov Postgres Professional