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 1sq216-006LRI-O4 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Sep 2024 03:03:10 +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 1sq1sA-00A4xy-7a for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Sep 2024 02:53:54 +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 1sq1s9-00A4xp-O7 for pgsql-hackers@lists.postgresql.org; Mon, 16 Sep 2024 02:53:53 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sq1s5-001PNu-Ca for pgsql-hackers@postgresql.org; Mon, 16 Sep 2024 02:53:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1726455228; bh=vZmTwZ+FFnFwb92Clo1q6IOAOO71dCsJNlGIPu5CpBA=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=jvnarhe1mrqDDpWng4uRud4dfYw1npkVXAkuz+8tdpf8KDG8Y/1O6gdYobEVHY9Lc 2pLgktKkhjjAivvSmvedgZu8JjBngFDt50VzuQdiCv/Jmj7yFZ6ldweJ3/CRJK4xdQ A2xkKYL+6C8STI3ypjOrIBoUcZFCRzXhE55IU0OEUmcmzGMdX0GdhQn463NbD2eVCm orZI2biSVmlg0EfD99ohEN/tVSJ7FHOJgmQby5t9Ni6TUZ8vjQodYBgCbPgvvtA7U3 c2hU1ABiS0Jt3RDBhJPjmoliAK7IRiC6sD8Z2jiqAeCXWJdfn1lmyOXa7+OCynfLL9 Yc+ikBr2fS6PQ== Received: from [192.168.124.77] (unknown [185.211.158.245]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.rybakina@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 17B5B60139; Mon, 16 Sep 2024 05:53:48 +0300 (MSK) Content-Type: multipart/alternative; boundary="------------3fVHEvJE8puE09IcPxFvsa5W" Message-ID: <3d418931-51c0-47bb-9f78-cd4270a29c5c@postgrespro.ru> Date: Mon, 16 Sep 2024 05:53:47 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: POC, WIP: OR-clause support for indexes To: Andrei Lepikhov , Alexander Korotkov Cc: jian he , Nikolay Shaplov , pgsql-hackers@lists.postgresql.org, Robert Haas , pgsql-hackers@postgresql.org, Peter Geoghegan , Marcos Pegoraro , teodor@sigaev.ru, Peter Eisentraut , Ranier Vilela References: <567ED6CA.2040504@sigaev.ru> <65bfdcb6-0f0c-4d4c-a721-cb38a0ba91c7@postgrespro.ru> <670d1dc2-a280-4cf6-bc29-e2eafb107081@gmail.com> <93464dd6-d484-4021-b71f-e82928bf6758@gmail.com> <63617a30-6078-4e86-b44b-6364e04e210d@postgrespro.ru> <21752e9e-26fb-4665-bfcc-090bf4093e5a@postgrespro.ru> Content-Language: en-US From: Alena Rybakina In-Reply-To: X-KSMG-AntiPhishing: NotDetected, bases: 2024/09/16 01:45:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2024/09/16 00:57:00 #26593812 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------3fVHEvJE8puE09IcPxFvsa5W Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi! On 09.09.2024 13:36, Alexander Korotkov wrote: > On Wed, Sep 4, 2024 at 6:42 PM Alena Rybakina wrote: >> On 04.09.2024 18:31, Alena Rybakina wrote: >>> I rewrote the tests with integer types. Thanks for your suggestion. If >>> you don't mind, I've updated the diff file you attached earlier to >>> include the tests. >> Sorry, I've just noticed that one of your changes with the regression >> test wasn't included. I fixed it here. > Please, find the revised patchset attached. I've integrated the fixes > by you and Andrei in the thread. Thank you for your work! It is fine now. > Also, I've addressed the note from > Andrei [1] about construction of RestrictInfos. > I decided to use make_simple_restrictinfo() in > match_orclause_to_indexcol(), because I've seen its usage in > get_index_clause_from_support(). I agree with that. I noticed this function is used for formation quals from modified clauses. We have the same case in our patch. > Also, I agree it get it's wrong to directly copy RestrictInfo struct > in group_similar_or_args(). Instead, I've renamed > make_restrictinfo_internal() to make_plain_restrictinfo(), which is > intended to handle non-recursive cases when you've children already > wrapped with RestrictInfos. I am willing to agree with renaming function because it processes the plain expression without recursive functionality sub expression. > make_plain_restrictinfo() now used in > group_similar_or_args(). > > Hopefully, this item is resolved by now. > > Links. > 1.https://www.postgresql.org/message-id/60760203-4917-4c6c-ac74-a5ee764735a4%40gmail.com > I think the case didn't resolve. As I understood the problem is related to uncleared cached estimations to default values, namely eval_cost, norm_selec, outer_selec variables in RestrictInfo. I assume we should reset it only for RestrictInfo including ScalarArrayOpExpr object that we got before after transformation. -- Regards, Alena Rybakina Postgres Professional --------------3fVHEvJE8puE09IcPxFvsa5W Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi!

On 09.09.2024 13:36, Alexander Korotkov wrote:
On Wed, Sep 4, 2024 at 6:42 PM Alena Rybakina <a.rybakina@postgrespro.ru> wrote:
On 04.09.2024 18:31, Alena Rybakina wrote:
I rewrote the tests with integer types. Thanks for your suggestion. If
you don't mind, I've updated the diff file you attached earlier to
include the tests.
Sorry, I've just noticed that one of your changes with the regression
test wasn't included. I fixed it here.
Please, find the revised patchset attached.  I've integrated the fixes
by you and Andrei in the thread.  
Thank you for your work! It is fine now.
Also, I've addressed the note from
Andrei [1] about construction of RestrictInfos.
I decided to use make_simple_restrictinfo() in
match_orclause_to_indexcol(), because I've seen its usage in
get_index_clause_from_support().
I agree with that. I noticed this function is used for formation quals from modified clauses. We have the same case in our patch.
Also, I agree it get it's wrong to directly copy RestrictInfo struct
in group_similar_or_args().  Instead, I've renamed
make_restrictinfo_internal() to make_plain_restrictinfo(), which is
intended to handle non-recursive cases when you've children already
wrapped with RestrictInfos.  
I am willing to agree with renaming function because it processes the plain expression without recursive functionality sub expression.
make_plain_restrictinfo() now used in
group_similar_or_args().

Hopefully, this item is resolved by now.

Links.
1. https://www.postgresql.org/message-id/60760203-4917-4c6c-ac74-a5ee764735a4%40gmail.com

I think the case didn't resolve. As I understood the problem is related to uncleared cached estimations to default values, namely eval_cost, norm_selec, outer_selec variables in RestrictInfo.

I assume we should reset it only for RestrictInfo including ScalarArrayOpExpr object that we got before after transformation.


-- 
Regards,
Alena Rybakina
Postgres Professional

--------------3fVHEvJE8puE09IcPxFvsa5W--