Refactor handling of nbtree array redundancies.
commitb524974106acb05ae4f9c2178153c3ead72eaf04
authorPeter Geoghegan <pg@bowt.ie>
Sat, 21 Sep 2024 17:25:49 +0000 (21 13:25 -0400)
committerPeter Geoghegan <pg@bowt.ie>
Sat, 21 Sep 2024 17:25:49 +0000 (21 13:25 -0400)
treecffa5f093eea9be8f1dbfc6e8ee0e128d34c1654
parent54562c9cfa2281b6303cdea1aff9596c4a5de4b2
Refactor handling of nbtree array redundancies.

Teach _bt_preprocess_array_keys to eliminate redundant array equality
scan keys directly, rather than just marking them as redundant.  Its
_bt_preprocess_keys caller is no longer required to ignore input scan
keys that were marked redundant in this way.  Oversights like the one
fixed by commit f22e17f7 are no longer possible.

The new scheme also makes it easier for _bt_preprocess_keys to output a
so.keyData[] scan key array with _more_ scan keys than it was passed in
its scan.keyData[] input scan key array.  An upcoming patch that adds
skip scan optimizations to nbtree will take advantage of this.

In passing, remove and rename certain _bt_preprocess_keys variables to
make the difference between our input scan key array and our output scan
key array clearer.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Tomas Vondra <tomas@vondra.me>
Discussion: https://postgr.es/m/CAH2-Wz=9A_UtM7HzUThSkQ+BcrQsQZuNhWOvQWK06PRkEp=SKQ@mail.gmail.com
src/backend/access/nbtree/nbtutils.c