Refine nbtree = redundancy preprocessing comment.
authorPeter Geoghegan <pg@bowt.ie>
Wed, 20 Nov 2024 18:37:08 +0000 (13:37 -0500)
committerPeter Geoghegan <pg@bowt.ie>
Wed, 20 Nov 2024 18:37:08 +0000 (13:37 -0500)
Spell out how a = key associated with a SAOP array renders a > key
against the same index column redundant at the relevant point inside
_bt_preprocess_keys.

Follow-up to commit 5bf748b8.

src/backend/access/nbtree/nbtutils.c

index d7603250279d9a87fe9ae28e68fe44d9d3d3bd2b..896696ff724b2ab6faa696a1e046e985293891ec 100644 (file)
@@ -2668,8 +2668,14 @@ _bt_preprocess_keys(IndexScanDesc scan)
 
            /*
             * If = has been specified, all other keys can be eliminated as
-            * redundant.  If we have a case like key = 1 AND key > 2, we can
-            * set qual_ok to false and abandon further processing.
+            * redundant.  Note that this is no less true if the = key is
+            * SEARCHARRAY; the only real difference is that the inequality
+            * key _becomes_ redundant by making _bt_compare_scankey_args
+            * eliminate the subset of elements that won't need to be matched.
+            *
+            * If we have a case like "key = 1 AND key > 2", we set qual_ok to
+            * false and abandon further processing.  We'll do the same thing
+            * given a case like "key IN (0, 1) AND key > 2".
             *
             * We also have to deal with the case of "key IS NULL", which is
             * unsatisfiable in combination with any other index condition. By