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 1teeF2-00EpF3-MM for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Feb 2025 17:58: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 1teeF1-007tt4-Rd for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Feb 2025 17:58:43 +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 1teeF1-007tsp-Hq for pgsql-hackers@lists.postgresql.org; Sun, 02 Feb 2025 17:58:43 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1teeEy-002osO-2c for pgsql-hackers@lists.postgresql.org; Sun, 02 Feb 2025 17:58:42 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5dc82e38c10so4831947a12.3 for ; Sun, 02 Feb 2025 09:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738519119; x=1739123919; darn=lists.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=wg7FQxzXepfJu2Y10X4UL8ylCWzz2mI/WXGHM2xyyiE=; b=goXd+YtPrw2lEtBppjDQNAvxvPWoaPw/YHzrDh4pTEiBnJTTAznFWiNPeKZ+6LuvNO 6FN9l3UYtefJy7aMZtM5Ue++EgdmKhRNMrZpdXRr3AY5+uzyVi93Kx+8nCoXBxmwUUWW Pq5DhmIwKYGyXGPHFaJ0rqUgY7PcNu6/EvzXeC/VZfkRruTyuYER/cN4hCX7b0pjmEMA jhqtoQvJCiZ6U9Lpiu16tkRFThfJWBvqBioL+49I108p5R+SoUJrF8Pp3NCDb6Z5tNNq 8oWqdsw4eHCGCxaCGqAwvZ1zLmzMWbX/2UxrZiAaBTpwnC61VwAGl3l6fkSp+B1Vd7Kw stzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738519119; x=1739123919; 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=wg7FQxzXepfJu2Y10X4UL8ylCWzz2mI/WXGHM2xyyiE=; b=L64oeQAKfd/6ibvGo57JlypZaofglrb8/aE+zmpea2JssOd+XiErRN7HCi2oJS2vKD tB5SSnQBwaFp0MWGi8rnBWh1qbUWaDArSFuBtGeFzTAyddYaBwFbvZl91hszzaeMLvex C1OBPZlwk+pvde9ohIxlQxxnPV6/pOT6rQdUPqdb+VaL9zCHFIo7ala2oC42AYVE1Xtw u9VksDrVQs5Yffyl/N7mnPuB1jBw/KQRNzuQiX+jmpXUZG7JzhypvbUK5RqmfagyL7cn lZA/v1hbwFoAnMWsN4LjgndFjHRX0+acFZ1ahSQnaoU9DwDkloOS3DVxkz5KP8N/t3/t O5yw== X-Forwarded-Encrypted: i=1; AJvYcCV6fb65wmqMxL5TvVja57tmrfxFyUIa6HGMYUoS45k5T3ijE1rk4/zFn/kLjP30XwBaiFkOXKZbd8jL369T@lists.postgresql.org X-Gm-Message-State: AOJu0YwpATQi0kzIQlUixdBAAjxgtjhsM91g9rbjVcX/I9wdyATEeX9X 52QuKpk+KfBGfSx0JXXy89J3j2sfKNk0f2y/TP0gzE+yE2Mi3TCYfd1HkR2UB0hLwDh99YRztUU kebZLk4mVmM+5lIysmeC9xbsI5sQ= X-Gm-Gg: ASbGncsGiPOVcpuwZUqsO7YCzjPgdJ+HsJb0S+wMQF1CC2II9riat7A0IS/w6JGU8Dz eWyvoRZEgdiDGtvZEPd7aGYAzVSl+bNn4FHqQw0wP8pd4bSnmioNPbiXVJq1b7IrjCDGvovWp X-Google-Smtp-Source: AGHT+IG/BnD4vY485iCWN+7w6RXoiFlXmXI0J3BeyySvihHoS+t063AkZcukFQuEqStN7ecYZ+th1DAPVMiuVNS1PQM= X-Received: by 2002:a05:6402:35d2:b0:5dc:8845:6a0d with SMTP id 4fb4d7f45d1cf-5dc88456b96mr9190612a12.14.1738519118945; Sun, 02 Feb 2025 09:58:38 -0800 (PST) MIME-Version: 1.0 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> <8cf87fc0-1f79-4427-8134-9245a1a52cf4@gmail.com> In-Reply-To: <8cf87fc0-1f79-4427-8134-9245a1a52cf4@gmail.com> From: Alexander Korotkov Date: Sun, 2 Feb 2025 19:58:27 +0200 X-Gm-Features: AWEUYZnjFpzOm5VvsjvdxC-tppBmtO69yUNPAiChZxE8DdxPxUH-tTc1XoyXx1I Message-ID: Subject: Re: POC, WIP: OR-clause support for indexes To: Andrei Lepikhov 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 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 Tue, Jan 28, 2025 at 10:42=E2=80=AFAM Andrei Lepikhov wrote: > 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 bu= t > > 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. OK, thank you! ------ Regards, Alexander Korotkov Supabase