Re: Saving stack space in nbtree's _bt_first function

From: Mircea Cadariu <cadariu(dot)mircea(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Saving stack space in nbtree's _bt_first function
Date: 2025-07-16 13:16:58
Message-ID: 84ef08d4-b6c9-4094-91c4-6354489f1a55@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16/07/2025 07:27, Peter Geoghegan wrote:

> [...] Rather, we rely on the generic logic that
> builds our startKeys[] entries. It will inevitably "break" before ever
> moving on to the next index attribute/next so->keyData[] key because
> strat_total will inevitably become
> BTGreaterStrategyNumber/BTLessStrategyNumber. In other words, the
> generic BTGreaterStrategyNumber/BTLessStrategyNumber test will
> inevitably cause the loop to "break" right after our first (and only)
> use of notnullkey.

Thanks for the elaboration and updated patch! Indeed, I see it's set in
the ScanKeyEntryInitialize to either BTGreaterStrategyNumber or
BTLessStrategyNumber, then few lines lower there's the if with the break.

I'm convinced.

I noticed this CI job failure for the V2, seems unrelated to the subject
of the patch though, does it need a retry?
https://cirrus-ci.com/task/5781246762024960

Kind regards,

Mircea Cadariu

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2025-07-16 13:36:48 Re: index prefetching
Previous Message Andrei Lepikhov 2025-07-16 12:41:20 Re: track generic and custom plans in pg_stat_statements