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 1raxjd-00CN0L-0J for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Feb 2024 12:54:33 +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 1raxjb-001z81-LP for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Feb 2024 12:54:31 +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 1raxjb-001z6p-Bv for pgsql-hackers@lists.postgresql.org; Fri, 16 Feb 2024 12:54:31 +0000 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1raxjY-00738N-0Y for pgsql-hackers@postgresql.org; Fri, 16 Feb 2024 12:54:30 +0000 Received: by mail-vs1-xe2f.google.com with SMTP id ada2fe7eead31-46d1bebe946so101676137.2 for ; Fri, 16 Feb 2024 04:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708088067; x=1708692867; 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=FA1OXuH0Kj0fdx+ppbzeZznLsPMlyZWeJlchoFppofg=; b=D7PiIQPj97LuOI6Vz//RTF0meXITZVrUbYTXh+amCW6h9DHnCIXDDCwcxclfG6ICA2 RZsNXlDaaW6+mwp/iLlk3ghO6JDQ9B+zvYbPbAALQ14hdZBzVbmQI4KD4/UGAkOVG/7y H/9xZ634KVuS0BxhAUia/BxiqbqsNySMm5j8NTeK1LGaR82EUhDDDFSnaSgmH4VMWq7K 6/VypAmGVMA1hYDpe5772lT6V44hSjQcAM2Tq+WCrABJpReWWZDkD8WQ0HN+RoZSLM8Z KB90NAT9kK/xJAHKqq/WctHGDyKO398Oc8meOzIj72a2mXimarGwS12YxLQZ92FTCrZy m73g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708088067; x=1708692867; 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=FA1OXuH0Kj0fdx+ppbzeZznLsPMlyZWeJlchoFppofg=; b=HUR8SefRsJOcNCwtfyfZrX4CyexYJ5nUSdO85xBfOHMooEuutRFv1hnGPJHoJUe+0F xNEneLXIo4jyZpz+r9bQWAuI/TzZfpMp8mMQoip75LMVfOHOhXloAypYQcjR+BNODqGe 9gwX0Henx7GnXfMptRtkZDUfr8cz97yZITx/eL3e04+tBrD/lgGReu7yvFyaPmoW2LnZ oL2H3pdbbzRuI1C0oxCWUH5qr7u6ar4pkNpPzDU6hPjSQWM+PP2YZQhzLAePFKTV6PEn 9q8eThdOYDPbxujW07fBBxPaGwH8VOHRmiJ3Omz7aWTVfe2tIMhmmWCcBIHR+CAPsA3x 4R7w== X-Forwarded-Encrypted: i=1; AJvYcCVh/rlviiUs8KOrW/91s8/oAiOz873nOqtKhIrtch8L7lA802OqfbybA76r2apyus3khfdpiJQT3fDieeYAv8N0+CTz9By+ooOHZHfY X-Gm-Message-State: AOJu0YwJCf63mqM2CKQYtxRcJnjAFmH5cqtQKqYI8IaTLsCg6pFq3jaW UyU8HCdxjrpdFI7Dt3aKZLoIx2NmT9mxeLLwsda8ZhpkuuXsnNRi+nGMQ5iE/wIPQlnEYA7J/uU jUUfa1Ywp9GjGWRkYVanjNTdKRg4= X-Google-Smtp-Source: AGHT+IGw0mHCnhcWZ5jZ5XHTUzIUUi4GvPwv+Zw0D3UVMO4fcXcWxuHqo0c6WTFW4iHlLvoG6t3fiiVDemAWLfLgvRQ= X-Received: by 2002:a05:6102:3048:b0:46d:14ac:da4d with SMTP id w8-20020a056102304800b0046d14acda4dmr5416377vsa.15.1708088067242; Fri, 16 Feb 2024 04:54:27 -0800 (PST) MIME-Version: 1.0 References: <567ED6CA.2040504@sigaev.ru> <59e67a40-95a8-4d74-ae4e-027ea0f59084@postgrespro.ru> <59b77a8a-29d6-4727-bf26-4a30a6a9719a@postgrespro.ru> <32d23d97-d07f-4d44-9933-ba3295fb3ed8@postgrespro.ru> <7e11e27b-7ab9-4d59-af0a-a921861a9206@postgrespro.ru> <13ad923a-33df-4b44-9e00-c9323cd4c37d@postgrespro.ru> <1cf6b382-6e27-4268-9f2a-54ada66eb2eb@postgrespro.ru> <5f119769-ab11-4807-abcc-71d5dd914ea0@postgrespro.ru> In-Reply-To: <5f119769-ab11-4807-abcc-71d5dd914ea0@postgrespro.ru> From: jian he Date: Fri, 16 Feb 2024 20:54:16 +0800 Message-ID: Subject: Re: POC, WIP: OR-clause support for indexes To: Andrei Lepikhov Cc: Alena Rybakina , Alexander Korotkov , Robert Haas , 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 Fri, Feb 16, 2024 at 1:32=E2=80=AFPM Andrei Lepikhov wrote: > > On 16/2/2024 07:00, jian he wrote: > > On Wed, Feb 14, 2024 at 11:21=E2=80=AFAM Andrei Lepikhov > > wrote: > > My OS: Ubuntu 22.04.3 LTS > > I already set the max_parallel_workers_per_gather to 10. > > So for all cases, it should use parallelism first? > > > > a better question would be: > > how to make the number of OR less than 29 still faster when > > enable_or_transformation is ON by only set parameters? > In my test environment this example gives some subtle supremacy to ORs > over ANY with only 3 ors and less. > Please, provide next EXPLAIN ANALYZE results for the case you want to > discuss here: > 1. with enable_or_transformation enabled > 2. with enable_or_transformation disabled > 3. with enable_or_transformation disabled but with manual transformation > OR -> ANY done, to check the overhead of this optimization. > you previously mentioned playing with parallel_tuple_cost and parallel_setup_cost. (https://www.postgresql.org/message-id/e3338e82-a28d-4631-9eec-b9c0984b32d5= %40postgrespro.ru) So I did by ` SET parallel_setup_cost =3D 0; SET parallel_tuple_cost =3D 0; ` After setting these parameters, overall enable_or_transformation ON is performance better. sorry for the noise. so now I didn't find any corner case where enable_or_transformation is ON peforms worse than when it's OFF. +typedef struct OrClauseGroupEntry +{ + OrClauseGroupKey key; + + Node *node; + List *consts; + Oid scalar_type; + List *exprs; +} OrClauseGroupEntry; I found that the field `scalar_type` was never used.