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 1tchBJ-001zZA-4B for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2025 08:42:49 +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 1tchBH-00HHAr-PK for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2025 08:42:47 +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 1tchBH-00HHAj-EJ for pgsql-hackers@lists.postgresql.org; Tue, 28 Jan 2025 08:42:47 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tchBF-001uKU-00 for pgsql-hackers@postgresql.org; Tue, 28 Jan 2025 08:42:46 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2165448243fso115418885ad.1 for ; Tue, 28 Jan 2025 00:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738053764; x=1738658564; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=UQsJIMwjVHkIZsqCumH+EyuzED4YNBCq4BQEdhBdXKE=; b=QmWz3kNhmMaFZg3H9cRF7cH5fdbDMhXc/BfhvfbpwD5FBa4B7HW5uJA0zRimSfCgy6 iTJjuH6rlYor6xdU6FJWMLSHicXEC2SMgMAHJMEkFaAtaGgRXA+JjQog9IYoCe0CNlWu kTfNR7wKcFizkh6llLwCs3D4LZx6FUDlx5L5kMOM5DOdsc3MFwG8Y7bnNJz2rPM6pfKD 4iqybd4RGK5rlp7OsVU+S/U8d51ZjSNvbxQDBYjLQPJktlSfMQHU99bgrobl3OIFc4Jq iM8+xW1XJ4Hf0XhNEMt4Hr8QdGsbhK+9S05gzRtz2Xy2s6M1vhVarNzZ2i64Gdv34XFT edsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738053764; x=1738658564; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UQsJIMwjVHkIZsqCumH+EyuzED4YNBCq4BQEdhBdXKE=; b=oosl721EI0S61UOt4nrl814zxsW5VvTGiAT9T8l+DJykolu3mJtx8Ev7XHNi2mzel5 eJlDKyo3Dq/xzrbuYi/b+aczxCHmEYd7wzm8H7x9/gYb9EJNXNtg1h8bIcmHX/JO4gX1 QHuMYfFPBNoD6saUh3RQmv/JXCvwnliMS7XIRmfCtRcKufG42iwXVIFYnyRLmDOQnvUH OG2ci+hUXCKZlN32xycFslEMzmo7HKb5SZou4SkEYzRmgXgqPZdmCziGrjWkundkaW99 FQ+ZH/PO39EfJePf466waKoSv3pzW36LvtAmFnv1rpvAJr2w+NwE/iiNFPcj+dGBqm6a h9vw== X-Forwarded-Encrypted: i=1; AJvYcCWmVo9dakHgvwo5c5w9ajj7AknzDFxfs4y+RzWg8nVUNZ52Ur5tabyZNPcR/SS9bMp5U2Bmgld23iz/dUnG@postgresql.org X-Gm-Message-State: AOJu0YwJQFYMGK25whjV3ycNOcrI0k3qO/HJH4vZr5N/FPikvLagfAJY PICAAkDg4gC598WsvRJp2SHPzkQQ7OcDqj6HlAtTOlC2x5Y1uJT2 X-Gm-Gg: ASbGnctKNiUqtJ/RHWEmvlaY8lHAXjUBb06ixwmjH5FK1cCJYZKWafXQUOTZS6dG4BP f+a+hjPIWbkTgRVNF7HtWx3HAZS+tqJVJ6nBdN2fQhiNXlv8BBLj9qFKf3FGL5fF8OYPREyjAh7 sZjhE3eYHU7CrTyA3p51JYFInJKoIv8RRdDO3xEZayz3axLnTuKNbLBgXQeYxVGZT4wfmUlQrUL 05i+hb910tuDD94Y8Au+KS4deNvALdBQyXowD0PGjxzU81aq/1Izf5xNQnh+wlpZLJZ6JgBv92B trPFwrbDpQxxjxEOERnkxzJiL6GqNK8SLe0lzxMHKQUn3JJgqYJsuCRpUTx/dq2OfQ3Q X-Google-Smtp-Source: AGHT+IE9w8DwW6DyKrwtstYK00lyYJiLDbs4VWOMCqkCqRb02XdysXDE+SntnN+OlcSDM07NSXlA1g== X-Received: by 2002:a17:903:1cf:b0:216:4853:4c0b with SMTP id d9443c01a7336-21c355eeb65mr701654585ad.33.1738053764308; Tue, 28 Jan 2025 00:42:44 -0800 (PST) Received: from [10.10.20.106] (node-u22.pool-101-109.dynamic.totinternet.net. [101.109.152.42]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac48fa81959sm7723344a12.21.2025.01.28.00.42.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Jan 2025 00:42:43 -0800 (PST) Message-ID: <8cf87fc0-1f79-4427-8134-9245a1a52cf4@gmail.com> Date: Tue, 28 Jan 2025 15:42:38 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: POC, WIP: OR-clause support for indexes From: Andrei Lepikhov To: Alexander Korotkov Cc: Alena Rybakina , Ranier Vilela , Alexander Lakhin , jian he , Robert Haas , Nikolay Shaplov , pgsql-hackers@lists.postgresql.org, pgsql-hackers@postgresql.org, Peter Geoghegan , Marcos Pegoraro , teodor@sigaev.ru, Peter Eisentraut References: <567ED6CA.2040504@sigaev.ru> <37bf870a-22e0-4aba-b845-549482118f8d@gmail.com> <8174de69-9e1a-0827-0e81-ef97f56a5939@gmail.com> <3b717020-14d9-425f-8c60-ce336b5a23b3@postgrespro.ru> <43db6a40-5c5f-4909-ad62-3060b297e686@postgrespro.ru> <41ba3d47-2a48-476c-88d4-6ebd889a7af2@gmail.com> <88844a88-57dd-4722-b697-15c10f1b81a7@gmail.com> Content-Language: en-AU In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/28/25 11:36, Andrei Lepikhov wrote: > On 1/27/25 16:50, Alexander Korotkov wrote: > qsort(matches, n, sizeof(OrArgIndexMatch), or_arg_index_match_cmp); > > To fit an index, the order of elements in the target array of the > `ScalarArrayOpExpr` may change compared to the initial list of OR > expressions. If there are indexes that cover the same set of columns but > in reverse order, this could potentially alter the position of a > Subplan. However, I believe this is a rare case; it is supported by the > initial OR path and should be acceptable. I beg your pardon - I forgot that we've restricted the feature's scope and can't combine OR clauses into ScalarArrayOpExpr if the args list contains references to different columns. So, my note can't be applied here. -- regards, Andrei Lepikhov