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 1sJBCq-002tE6-EN for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jun 2024 12:11:28 +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 1sJBCn-00GBla-5H for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jun 2024 12:11:26 +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 1sJBCm-00GBlR-P1 for pgsql-hackers@lists.postgresql.org; Mon, 17 Jun 2024 12:11:25 +0000 Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sJBCl-001kFX-0F for pgsql-hackers@postgresql.org; Mon, 17 Jun 2024 12:11:24 +0000 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-6319bf71f28so35147317b3.1 for ; Mon, 17 Jun 2024 05:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718626282; x=1719231082; 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=hwLgKuQKSaMEk/2vEU3Km/nqOEi6yadM2SCPKbxet6A=; b=hX6W4r5qnR9jiYN3MnUK7VpXAJ1cGfmnnL/SbOASkaDBXNYVJ+V42RgXxwsvVCToqr 6gPRuwLvDV91uit0EF2mc7xTMHO1dtsYJ9DLhOW80+XYwyo429Thl/RaR82D8dizHVl2 21Pl/22phe8dNBNYUtkEHd46kmjJucnpHfJ5LrvgjoKPvpk0JqorYwyKR6DRolRNzQCN ZHqnXFGZDmKorWbhGR2hoX5ZTDHWcm3z3QQTNnJ4/AwIJCAhVBoZjbQd21+tABUWvmki FyUUjAT1wHsTEwogLbm4wHi3NtntM7PKZntmLZiUu2C0RKclJRGYZYlk/wcpRXwkz4E4 BW5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718626282; x=1719231082; 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=hwLgKuQKSaMEk/2vEU3Km/nqOEi6yadM2SCPKbxet6A=; b=QbVOZLpZffzJRtzEGFDN/MLnVP2F+KYdDSnZ5O6OP6u4Y00ITGOtvu3SN58W5odIMz cRM/xXfAP8rwVsx1RMmgOQFyq7JObHR4EPL3u1q9m5HXNCvyDDkw1rAAke6X+4czjf9U feaheBmqmZMmH2owz1fl4wMwRzazviE6ygrXv34oTYa3oIWEBWUdayoDzeyQlEPNUXjv DoHQoPXD/AglAAvU/2VUz0fXJZ7bLqk9wxFQjmC1JdVzdXFvrqj6+lUT78F0ItXCDk2m SwTknDNW7HBu1pMlV5w9Y8GBdLSqBLO99zyGZxII6yceIck9jVtoNQ0hVpolkZP9qbgq vYVQ== X-Forwarded-Encrypted: i=1; AJvYcCUWtIhafh3uwYKiqH4yQUG9IfCmD3Mlnr1kKOkva2TNZ2kMswVNC+Or8tze2MzDknJHimZKaF1wx6/ukWe03i5RWP5JGZvXJa/YrpsB X-Gm-Message-State: AOJu0Yxv3nPuuscbCLqAY8FROWEd96+5eS/75ngTNsPIWvJtapT5Cizf XjPcR+539Am2QqpNQwLgyBwS8Nsb+qfEmEexhGN/s6kjez8Uhnml6GATSXDSRrKWlQbFj0kbKYw w3X0A+h476NGVv8ORepL7W/lxMb4= X-Google-Smtp-Source: AGHT+IHyF0Z/66FoTK9t7KfRg1UdgaBSuqugoASIbcBfvaniVe9ut/zgS0TyTtwur1IzFhMzJn3vHyIRrQCjRYvaA8s= X-Received: by 2002:a25:ac60:0:b0:de6:5f4:5429 with SMTP id 3f1490d57ef6-dff1549186dmr8197980276.46.1718626281865; Mon, 17 Jun 2024 05:11:21 -0700 (PDT) MIME-Version: 1.0 References: <567ED6CA.2040504@sigaev.ru> <7389d0dd-05d5-41b7-a12d-2e73f939f851@postgrespro.ru> <74e3c8bc-dccd-45e5-ad2d-6a6e96fc5864@postgrespro.ru> <6d27d752-db0b-4cac-9843-6ba3dd7a1e94@postgrespro.ru> <7d5aed92-d4cc-4b76-8ae0-051d182c9eec@postgrespro.ru> In-Reply-To: <7d5aed92-d4cc-4b76-8ae0-051d182c9eec@postgrespro.ru> From: Alexander Korotkov Date: Mon, 17 Jun 2024 15:11:09 +0300 Message-ID: Subject: Re: POC, WIP: OR-clause support for indexes To: Alena Rybakina Cc: Andrei Lepikhov , jian he , Robert Haas , pgsql-hackers@postgresql.org, Peter Geoghegan , "Finnerty, Jim" , Marcos Pegoraro , teodor@sigaev.ru, Tomas Vondra , Peter Eisentraut , Ranier Vilela 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, Jun 17, 2024 at 1:33=E2=80=AFPM Alena Rybakina wrote: > I noticed that 7 libraries have been added to src/backend/optimizer/plan/= initsplan.c, and as far as I remember, Tom Lane has already expressed doubt= s about the approach that requires adding a large number of libraries [0], = but I'm afraid I'm out of ideas about alternative approach. Thank you for pointing. Right, the number of extra headers included was one of points for criticism on this patch. I'll look to move this functionality elsewhere, while the stage of transformation could probably be the same. > In addition, I checked the fix in the previous cases that you wrote earli= er [1] and noticed that SeqScan continues to generate, unfortunately, witho= ut converting expressions: I've rechecked and see I made wrong conclusion about this. The plan regression is still here. But I'm still looking to workaround this without extra GUC. I think we need to additionally do something like [1], but take further steps to avoid planning overhead when not necessary. In particular, I think we should only consider splitting SAOP for bitmap OR in the following cases: 1. There are partial indexes with predicates over target column. 2. There are multiple indexes covering target column and different subsets of other columns presented in restrictions. 3. There are indexes covreing target column without support of SAOP (amsearcharray =3D=3D false). Hopefully this should skip generation of useless bitmap paths in majority cases. Thoughts? Links. 1. https://www.postgresql.org/message-id/67bd918d-285e-44d2-a207-f52d9a4c35= e6%40postgrespro.ru ------ Regards, Alexander Korotkov Supabase