pgsql: nbtree: Use only one notnullkey ScanKeyData. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: nbtree: Use only one notnullkey ScanKeyData.
Date
Msg-id E1uc5aQ-006cJr-2R@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Jeff Davis
Date:
Subject: pgsql: pg_dumpall: Skip global objects with --statistics-only or --no-s
Next
From: Álvaro Herrera
Date:
Subject: pgsql: Fix dumping of comments on invalid constraints on domains