pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: nbtree: Use only one notnullkey ScanKeyData.
Date: Wed, 16 Jul 2025 17:06:30 +0000
Message-ID: <E1uc5aQ-006cJr-2R@gemulon.postgresql.org> (raw)

nbtree: Use only one notnullkey ScanKeyData.

_bt_first need only store one ScanKeyData struct on the stack for the
purposes of building an IS NOT NULL key based on an implied NOT NULL
constraint.  We don't need INDEX_MAX_KEYS-many ScanKeyData structs.

This saves us a little over 2KB in stack space.  It's possible that this
has some performance benefit.  It also seems simpler and more direct.

It isn't possible for more than a single index attribute to need its own
implied IS NOT NULL key: the first such attribute/IS NOT NULL key always
makes _bt_first stop adding additional boundary keys to startKeys[].
Using INDEX_MAX_KEYS-many ScanKeyData entries was (at best) misleading.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Mircea Cadariu <cadariu.mircea@gmail.com>
Discussion: https://postgr.es/m/CAH2-Wzm=1kJMSZhhTLoM5BPbwQNWxUj-ynOEh=89ptDZAVgauw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4c8ad67a98b5d84c1ca00a26d53d08f2d2b881aa

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)



Message-ID: <E1uc5aQ-006cJr-2R@gemulon.postgresql.org>
Permalink:  ../E1uc5aQ-006cJr-2R@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uc5aQ-006cJr-2R@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: pg@bowt.ie, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: nbtree: Use only one notnullkey ScanKeyData.
  In-Reply-To: <E1uc5aQ-006cJr-2R@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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