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 1tcdLN-001Wyv-Tv for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2025 04:36:58 +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 1tcdLM-00GNqc-Nn for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2025 04:36:56 +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 1tcdLM-00GNqT-EB for pgsql-hackers@lists.postgresql.org; Tue, 28 Jan 2025 04:36:56 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tcdLJ-001sRE-2B for pgsql-hackers@lists.postgresql.org; Tue, 28 Jan 2025 04:36:55 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-21631789fcdso82315845ad.1 for ; Mon, 27 Jan 2025 20:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738039013; x=1738643813; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=rlBm50JNzMjwujvEcAzFalrTLE2FTgI3aC0qhE//NpU=; b=M1OP1RmbxqOTurnLOIIyxnw4xrOagSc+kUSpeZkUv6nAzZITS7ntfDvpw/0V2qzRr9 rR4rXaze6aBokX8tlZ834I5wtVESGvTTjiJ9x9QCefs930QNZvZGjWF0vnxKbj3L2W3d 7d7JuCXAB49hdfs3MQH1i5h+Sni27h1RaBz6eILXZ41ZkGS5V66XqMzM4iJh/1/LMthF LRsKDQRf4PBa5wOHM0aDCVUcYrL6lCg/41xZ1bBQx2n4pBpkvI5g/V3/+KvaGmdyuIar K1olwLeWKmpwOwN9mbtoIeBXLRx68Bqsk0kFUqg9utEHj14ykI8L1v67EOqPHT1/hqwI nftQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738039013; x=1738643813; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rlBm50JNzMjwujvEcAzFalrTLE2FTgI3aC0qhE//NpU=; b=GIQrXj9rDWKoNonV2+i1vWKfwp1yX763UGOI2nUVM+9DFbsVMIQ+C2FYJOOttaOvgl yIDn/bG6QQZ5M+0i3u1fd898s4PO87hkTHDM95cFDw9nVpXjYwyYKvlka7vkT06FFiLj iVCmmVtqIVxsmON9f6MnIFrKJhuQ7YnA5Iqmu6I6PyPweHo8D1d++SGfYbe6fInXsMNJ k2Hc2gkLzFsnoxekmrvrWR/cbKnBKghHnUKo69oq5yB9xoZWsdYUkc60CEVX6QRX6KlY 8jZ9LWM6AZO5Ib1naltLhYVYsFofr4vVff+T69NTkEaVkDNybXdK6Sc4RhigTdr4r0XC Hoaw== X-Forwarded-Encrypted: i=1; AJvYcCWb2C+HiuOGO1T+hRiT1QDbyW4RLZQOJ+yUp5JTD1DI98G+8Sil7jcmRk810PzWkvXFN6hzNrVxNOri0pmU@lists.postgresql.org X-Gm-Message-State: AOJu0YxOZqndUGo9N3xhlqmwHkBAI/bsQ5oOSCuyG9U44YVIlHY/ZUoX cNYN0oGkvKRXmpNOZRI0AW/BB6uTwyGNwSBe2fhgLkimZlFFU9RL X-Gm-Gg: ASbGncvvfx8U44noYYssbVXOgPRFOivk1NFmQwGibaER5AuP0hZ4LiuoQGIHYzV5hZ1 L9WYAfOF42aXjO5B9yDPT6oSRkJNtk/7WJUVmn4NxOQTU//B3PChwtBC2NeQDVYts6Ed9wp3aD3 hT6nEbK9jfc2P5S+FFDf1jMlKuSoU3t2bPCevGtyZVA/jwgT44ZWvuMhTn3VhXHmFV/WsnWBrB5 g8IaCKZWv/xVnlCc1QiLvK9AGW7unwlkChjoDrx8cbh9QNePeI2AcdweEt0GYF3y8CMLf3eLck3 PtRfA1a6XiPaq5x2lak/IP9CdYKnrBCh3ieC1WVYbf0l1JWSERT4EEUZjErhQWsgI47y4XQPYqH qYuE= X-Google-Smtp-Source: AGHT+IHISlaSHI/HrUf+Tedb48wTUlNq1pNXL4gA/fArIcPNhgPwwYch0p0gQqAz/ZwyPQfINmFpjw== X-Received: by 2002:a05:6a00:2a08:b0:725:d64c:f122 with SMTP id d2e1a72fcca58-72fc0886e88mr3583400b3a.2.1738039012910; Mon, 27 Jan 2025 20:36:52 -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 d2e1a72fcca58-72f8a69fcbfsm8046783b3a.30.2025.01.27.20.36.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jan 2025 20:36:52 -0800 (PST) Message-ID: Date: Tue, 28 Jan 2025 11:36:47 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: POC, WIP: OR-clause support for indexes 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 From: Andrei Lepikhov 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 1/27/25 16:50, Alexander Korotkov wrote: > I expressed my point on this in [1].  We generally greedy about index > quals and there is no logic which prevent us from using a clause and > index qual because of its cost.  And there are many cases when this > causes regressions before d4378c0005.  One of examples from [1]. Ok, Generally, I don't concern myself with the evaluation of individual subplans. As you mentioned, it should be a rare occurrence when this becomes important. My main concern is the shift in frequency of evaluations during execution for various reasons. For example: 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. So, I do not have any further objections at this time. -- regards, Andrei Lepikhov