| From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
|---|---|
| To: | Andy Fan <zhihuifan1213(at)163(dot)com> |
| Cc: | 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-03 03:08:26 |
| Message-ID: | CAH2-Wz=YYoxSpUrPT+cofJQSAd=xEtBTTQX6FCxBhQSvbF-OhA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Jul 27, 2025 at 9:43 AM Andy Fan <zhihuifan1213(at)163(dot)com> wrote:
> At last, I can get the same test result as you. The buffer hits go back to
> 23 in the test case, thank for working on this!
>
> > I think that this patch isn't too far off being committable.
>
> I think so.
Coming back to this patch now, after several months of work on index
prefetching.
I decided that it wasn't such a great idea to reuse/steal an unused
"itemDead" bit from the BTScanPosItem.itemOffset field after all. That
forces _bt_killitems to iterate through every so->currPos.item[], not
just those that are known to require LP_DEAD marking.
Tomas Vondra suggested that I keep killedItems as a separate
allocation (as it is on master), while using a Bitmapset to represent
killedItems (unlike on master, where it is represented using a simple
array). This has all of the same advantages as my previous approach,
but doesn't have the aforementioned disadvantages within _bt_killitems
(plus we no longer need to change BTScanPosItem in any way).
Attached is v4, which does it that way.
My plan is to commit this improved version in the next couple of days.
--
Peter Geoghegan
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-Return-TIDs-in-desc-order-during-backwards-scans.patch | application/octet-stream | 13.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ajin Cherian | 2025-12-03 03:21:35 | Re: Improve pg_sync_replication_slots() to wait for primary to advance |
| Previous Message | Chao Li | 2025-12-03 02:28:36 | Re: Cleanup shadows variable warnings, round 1 |