pgsql: Refactor handling of nbtree array redundancies.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Refactor handling of nbtree array redundancies.
Date: 2024-09-21 17:26:10
Message-ID: E1ss3s1-000IgY-SC@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)bowt(dot)ie>
Reviewed-By: Tomas Vondra <tomas(at)vondra(dot)me>
Discussion: https://postgr.es/m/CAH2-Wz=9A_UtM7HzUThSkQ+BcrQsQZuNhWOvQWK06PRkEp=SKQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b524974106acb05ae4f9c2178153c3ead72eaf04

Modified Files
--------------
src/backend/access/nbtree/nbtutils.c | 210 +++++++++++++++++------------------
1 file changed, 100 insertions(+), 110 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2024-09-21 18:18:21 pgsql: Increase the number of fast-path lock slots
Previous Message Tom Lane 2024-09-20 20:38:04 pgsql: Improve Asserts checking relation matching in parallel scans.