pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Document nbtree row comparison design.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Document nbtree row comparison design.
@ 2025-11-02 20:28 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Geoghegan @ 2025-11-02 20:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Document nbtree row comparison design.

Add comments explaining when and where it is safe for nbtree to treat
row compare keys as if they were simple scalar inequality keys on the
row's most significant column.  This is particularly important within
_bt_advance_array_keys, which deals with required inequality keys in a
general and uniform way, without any special handling for row compares.

Also spell out the implications of _bt_check_rowcompare's approach of
_conditionally_ evaluating lower-order row compare subkeys, particularly
when one of its lower-order subkeys might see NULL index tuple values
(these may or may not affect whether the qual as a whole is satisfied).
The behavior in this area isn't particularly intuitive, so these issues
seem worth going into.

In passing, add a few more defensive/documenting row comparison related
assertions to _bt_first and _bt_check_rowcompare.

Follow-up to commits bd3f59fd and ec986020.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>
Reviewed-By: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAH2-Wznwkak_K7pcAdv9uH8ZfNo8QO7+tHXOaCUddMeTfaCCFw@mail.gmail.com
Backpatch-through: 18

Branch
------
master

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

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c |  8 +++--
src/backend/access/nbtree/nbtutils.c  | 63 ++++++++++++++++++++++++++++++-----
2 files changed, 60 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Document nbtree row comparison design.
@ 2025-11-02 20:28 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Geoghegan @ 2025-11-02 20:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Document nbtree row comparison design.

Add comments explaining when and where it is safe for nbtree to treat
row compare keys as if they were simple scalar inequality keys on the
row's most significant column.  This is particularly important within
_bt_advance_array_keys, which deals with required inequality keys in a
general and uniform way, without any special handling for row compares.

Also spell out the implications of _bt_check_rowcompare's approach of
_conditionally_ evaluating lower-order row compare subkeys, particularly
when one of its lower-order subkeys might see NULL index tuple values
(these may or may not affect whether the qual as a whole is satisfied).
The behavior in this area isn't particularly intuitive, so these issues
seem worth going into.

In passing, add a few more defensive/documenting row comparison related
assertions to _bt_first and _bt_check_rowcompare.

Follow-up to commits bd3f59fd and ec986020.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>
Reviewed-By: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAH2-Wznwkak_K7pcAdv9uH8ZfNo8QO7+tHXOaCUddMeTfaCCFw@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6c3b1df878a65bb76e21ed640add30391db8f1d7

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c |  8 +++--
src/backend/access/nbtree/nbtutils.c  | 61 ++++++++++++++++++++++++++++++-----
2 files changed, 58 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-11-02 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-11-02 20:28 pgsql: Document nbtree row comparison design. Peter Geoghegan <pg@bowt.ie>
2025-11-02 20:28 pgsql: Document nbtree row comparison design. Peter Geoghegan <pg@bowt.ie>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox