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

From Chao Li
Subject Re: Returning nbtree posting list TIDs in DESC order during backwards scans
Date
Msg-id 9EDF07A2-F7CC-417A-94ED-3DF6EAE3C106@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 Dec 4, 2025, at 01:31, Peter Geoghegan <pg@bowt.ie> wrote:
>
>
> Note also that we'll use much less memory for killedItems by
> representing it as a Bitmapset. We'll use at most one bit per
> so->currPos.items[] item, whereas before we used 4 bytes per item.
>

That’s true, BitmapSet saves 7/8 of memory usage for killedItems. However, it also brings a little performance burden,
becausebms_next_member() does O(N) iteration. Say so->curPos.items[] = {0, 1000}, the old code directly gives 0 and
1000to the “for” loop, but the new code needs to iterate over 999 bits to get next member 1000. Maybe that’s
affordable.

Actually MaxTIDsPerBTreePage (max length of so->curPos.items[]) is a value around 1000, in the old code, killedItems
couldbe “short *” instead of “int *”, which may also save a half of memory usage. 

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Re: Add support for specifying tables in pg_createsubscriber.
Next
From: Dilip Kumar
Date:
Subject: Re: How can end users know the cause of LR slot sync delays?