| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Peter Geoghegan <pg(at)bowt(dot)ie> |
| Cc: | Andy Fan <zhihuifan1213(at)163(dot)com>, Mircea Cadariu <cadariu(dot)mircea(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Returning nbtree posting list TIDs in DESC order during backwards scans |
| Date: | 2025-12-04 03:24:16 |
| Message-ID: | 9EDF07A2-F7CC-417A-94ED-3DF6EAE3C106@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Dec 4, 2025, at 01:31, Peter Geoghegan <pg(at)bowt(dot)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, because bms_next_member() does O(N) iteration. Say so->curPos.items[] = {0, 1000}, the old code directly gives 0 and 1000 to 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 could be “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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dilip Kumar | 2025-12-04 03:24:23 | Re: How can end users know the cause of LR slot sync delays? |
| Previous Message | vignesh C | 2025-12-04 02:56:42 | Re: Re: Add support for specifying tables in pg_createsubscriber. |