aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2024-11-20 13:37:08 -0500
committerPeter Geoghegan <pg@bowt.ie>2024-11-20 13:37:08 -0500
commit70743376987af2393e42f3cfc2def4a472070659 (patch)
tree16473d5e4571787dadde0302d8c17b9fcaa24a30 /src
parent94131cd53c1552efe85c3e8120356c22cd658163 (diff)
downloadpostgresql-70743376987af2393e42f3cfc2def4a472070659.tar.gz
postgresql-70743376987af2393e42f3cfc2def4a472070659.zip
Refine nbtree = redundancy preprocessing comment.
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/nbtree/nbtutils.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index d7603250279..896696ff724 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -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