Re: Returning nbtree posting list TIDs in DESC order during backwards scans - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Returning nbtree posting list TIDs in DESC order during backwards scans
Date
Msg-id CAH2-Wzn3Qu6XcLUF++ZpHWWOXO--2dFZgXbhnuC-H8krvH=3sA@mail.gmail.com
Whole thread Raw
In response to Re: Returning nbtree posting list TIDs in DESC order during backwards scans  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
On Thu, Jul 17, 2025 at 2:26 PM Peter Geoghegan <pg@bowt.ie> wrote:
> The loop has an early check for this (for non-itemDead entries) here:
>
>         /* Quickly skip over items never ItemDead-set by btgettuple */
>         if (!kitem->itemDead)
>             continue;
>
> I really doubt that this matters

I think that this patch isn't too far off being committable. I'll need
to think about issues around adding the new kitem->itemDead bitfield.
I'm not really worried about _bt_killitems; more so about the routines
called by _bt_readpage, which must make sure that the bit is unset
every time a TID is saved in so->currPos.items[].

Attached is v3. Not much has changed. We now defensively unset each
previously set kitem->itemDead within _bt_killitems. I've also added a
pair of macros that represent 0 and 1 values for these kitem->itemDead
bits.

Thanks
--
Peter Geoghegan

Attachment

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Collation and primary keys
Next
From: Masahiko Sawada
Date:
Subject: Re: POC: Parallel processing of indexes in autovacuum