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 1r7im1-006S5n-8x for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2023 21:04:09 +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 1r7ilz-00Gg1s-VM for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2023 21:04:07 +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 ) id 1r7ilz-00Gg1F-JI for pgsql-hackers@lists.postgresql.org; Mon, 27 Nov 2023 21:04:07 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r7ilw-007ezw-O6 for pgsql-hackers@postgresql.org; Mon, 27 Nov 2023 21:04:06 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-548d60a4d60so6259201a12.2 for ; Mon, 27 Nov 2023 13:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701119043; x=1701723843; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=J64MMGl9hCHU3hOlhaNu5rpikdOiukDMoj+w0nvYf60=; b=ZT2HU6Byu3kxhCZ5aCQb1cDLnw26Z2FIGoYyzg4x21o6BDpb7v4rC5vpe7IKm/R3Ir oq09Ms4S2BGh5MU0LOTyZuRL0VWFKoqxF8EFvI0rI7Xrh9oNeSZmqktAq63UI82HR4R8 wpsRTEqA+Vbxcq1STrxgj3rOZjICIwvzYRxXLN6rVz/SI8FIpyKzhQQccyHvE++v7/zx 1/L/ySFi5iGQwO6UIhXgFfupi/Rza9gOxLAVjxzIE77irWyAXMfHEtJLGtFScNOfw1gO vtuyOQ+UCvz5LvzvXyFlrMn3os4l1hDXz6EFF0zsZvdhg5FRxeHRi3e+j5nabZs51/A/ rc2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701119043; x=1701723843; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J64MMGl9hCHU3hOlhaNu5rpikdOiukDMoj+w0nvYf60=; b=qzLR20GGy3o8xktfj6GnX5qt87yK1re+HoyOs7yxF4TWClgnSBiAUgdVQFvDu4p2je icDSohFjs0i8M2fyaXPaWM1vCNT6LcyFFof014L+qAtKxKXK8LmoOOztXnMGySvvbbF7 QnXK4HGElVvIjuP3BoWS1y6RRtGkhHrEuD3+5b0kKxrukeC7YqKAGxh6VFx3MhZdS6Q9 xUaEUH4aRIZMhrdY16PlyMnRHWZhe86gW1/8q7OFlYAPuQz2TKFyrJj12SiEr39Cy75E RORSKZ2yipQagnGCeEfR9hE98MdNnfq/lBCp6IVgiv4T8SDVIec+cgh2sI1hZwPU+nLB tYHQ== X-Gm-Message-State: AOJu0Yzfz/rcT32m1mlqBOKyB/EZXw4lfE8a2Uzi0ARfnLsEvSaq+d96 dFyd+MGqsIXwUwWlGXzoWzhfQmUAt6PbByQ5cBs= X-Google-Smtp-Source: AGHT+IHsVcy5gSn3OmbPdTtvZc9gGOZ+WvIgot4LJS9HiAocNecbFzyPbLuPK2ON7m2AJA5/Coz6Dm7Cc/clQ8knArs= X-Received: by 2002:a17:906:748d:b0:a0d:e546:56e8 with SMTP id e13-20020a170906748d00b00a0de54656e8mr4558341ejl.7.1701119042980; Mon, 27 Nov 2023 13:04:02 -0800 (PST) MIME-Version: 1.0 References: <567ED6CA.2040504@sigaev.ru> <16a7e3aa-24c0-4986-8820-ea2857bd7b6b@postgrespro.ru> <421656a9-5df7-41bb-9d58-1c1edbd5dc3e@postgrespro.ru> <28c727ba-5260-42a8-88b0-4ecdeeca6ef8@postgrespro.ru> <4c1c2c0b-802f-45ae-a7cd-007bfd8957cf@postgrespro.ru> <52f0d302-7963-452f-8c5a-f66d261514eb@postgrespro.ru> <43ad8a48-b980-410d-a83c-5beebf82a4ed@postgrespro.ru> <04ef16eb-46c1-4ce7-9f68-d1c80ef0be81@postgrespro.ru> In-Reply-To: <04ef16eb-46c1-4ce7-9f68-d1c80ef0be81@postgrespro.ru> From: Robert Haas Date: Mon, 27 Nov 2023 16:03:50 -0500 Message-ID: Subject: Re: POC, WIP: OR-clause support for indexes To: Andrei Lepikhov Cc: Alexander Korotkov , Alena Rybakina , pgsql-hackers@postgresql.org, Peter Geoghegan , "Finnerty, Jim" , Marcos Pegoraro , teodor@sigaev.ru, Ranier Vilela , Tomas Vondra , Peter Eisentraut Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 27, 2023 at 3:02=E2=80=AFAM Andrei Lepikhov wrote: > On 25/11/2023 08:23, Alexander Korotkov wrote: > > I think patch certainly gets better in this aspect. One thing I can't > > understand is why do we use home-grown code for resolving > > hash-collisions. You can just define custom hash and match functions > > in HASHCTL. Even if we need to avoid repeated JumbleExpr calls, we > > still can save pre-calculated hash value into hash entry and use > > custom hash and match. This doesn't imply us to write our own > > collision-resolving code. > > Thanks, it was an insightful suggestion. > I implemented it, and the code has become shorter (see attachment). Neither the code comments nor the commit message really explain the design idea here. That's unfortunate, principally because it makes review difficult. I'm very skeptical about the idea of using JumbleExpr for any part of this. It seems fairly expensive, and it might produce false matches. If expensive is OK, then why not just use equal()? If it's not, then this probably isn't really OK either. But in any case there should be comments explaining why this strategy was chosen. The use of op_mergejoinable() seems pretty random to me. Why should we care about that? If somebody writes a<1 or a<2 or a<3 or a<4, you can transform that to a