v1-0001-Add-enable_or_transformation-doc-entry.no-cfbot

application/octet-stream

Filename: v1-0001-Add-enable_or_transformation-doc-entry.no-cfbot
Type: application/octet-stream
Part: 0
Message: Re: POC, WIP: OR-clause support for indexes
From 6c6fc58facfcf8545f46c8e38eae5efd7918aa59 Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Sat, 24 Feb 2024 19:12:18 +0800
Subject: [PATCH v1 1/1] Add enable_or_transformation doc entry

enable_or_transformation GUC explanation.
---
 doc/src/sgml/config.sgml | 54 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index ffd711b7..b14c5c0e 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5276,6 +5276,60 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
       </listitem>
      </varlistentry>
 
+     <varlistentry id="guc-enable-or-transformation" xreflabel="enable_or_transformation">
+      <term><varname>enable_or_transformation</varname> (<type>boolean</type>)
+       <indexterm>
+        <primary><varname>enable_or_transformation</varname> configuration parameter</primary>
+       </indexterm>
+      </term>
+      
+      <listitem>
+       <para>
+        Enables or disables the query planner's ability to transform mulitple expressions in (<xref linkend="sql-expressions"/>)
+        <xref linkend="sql-where"/> to a ANY expression (<xref linkend="functions-comparisons-any-some"/>).
+        This  transformations only applys under the following condidtion:
+<itemizedlist>
+<listitem>
+<para>
+Each expression should be formed as: <replaceable>expression</replaceable> <replaceable>operator</replaceable>  (<replaceable>expression</replaceable>).
+The right-hand side of the operator should be just a plain constant.
+The left-hand side of these expressions should remainn the same.
+</para>
+</listitem>
+</itemizedlist>
+
+<itemizedlist>
+<listitem>
+<para>
+      Each expression form should return Boolean (true/false) result.
+</para>
+</listitem>
+</itemizedlist>
+
+<itemizedlist>
+<listitem>
+<para>
+These expressions are logically linked in a OR condition.
+</para>
+</listitem>
+</itemizedlist>
+        The default is <literal>on</literal>.
+       </para>
+   <para>
+    For example, the following query without set <varname>enable_or_transformation</varname>, normally apply to three filter conditions seperately,
+    but if we set <varname>enable_or_transformation</varname>, then we can combine these three expressions to just one expression: <literal>unique1 = ANY ('{1,2,3}'::integer[]) </literal>.
+<programlisting>
+EXPLAIN SELECT * FROM tenk1 WHERE unique1 = 1 or unique1 = 2 or unique1 = 3;
+
+                         QUERY PLAN
+-------------------------------------------------------------
+ Seq Scan on tenk1  (cost=0.00..482.50 rows=3 width=244)
+   Filter: (unique1 = ANY ('{1,2,3}'::integer[]))
+</programlisting>
+   </para>
+      </listitem>
+     </varlistentry>
+
      <varlistentry id="guc-enable-parallel-append" xreflabel="enable_parallel_append">
       <term><varname>enable_parallel_append</varname> (<type>boolean</type>)
       <indexterm>
-- 
2.34.1