Re: Removing BTScanPosUnpinIfPinned idiom from nbtree, simplifying mark/restore support
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Tomas Vondra <tomas@vondra.me>
Date: 2025-12-03T21:10:44Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Make _bt_killitems drop pins it acquired itself.
- 7c319f54917f 18.0 cited
-
Avoid BufferGetLSNAtomic() calls during nbtree scans.
- e6eed40e4441 18.0 cited
-
Reduce pinning and buffer content locking for btree scans.
- 2ed5b87f96d4 9.5.0 cited
On Wed, Jun 11, 2025 at 1:29 PM Peter Geoghegan <pg@bowt.ie> wrote: > Removing BTScanPosUnpinIfPinned allows me to significantly simplify > the management of buffer pins with mark/restore. The patch also gets > rid of all of the calls to IncrBufferRefCount made from > nbtree, since it's no longer necessary to support a so->markPos > representation of a mark that needs its own pin, independent of the > pin held by/for so->currPos (if so->markPos needs its own pin it'll be > because it has its own page). I'm going to withdraw this patch. The rationale for the patch still makes perfect sense. However, the patch has now been superseded by the ongoing work on adding a new amgetbatch interface. That other work (which is tied up in work on I/O prefetching for index scans) does everything that this patch does as a stepping stone to allowing nbtree index scans to return batches (so->currPos style positions that contain at least one matching item to return to the scan) that are controlled by the caller/the table AM that manages the index scan. Independently implementing these changes without any of the much more extensive changes required for amgetbatch was a useful exercise. But there's no reason to keep the patch in the next CF anymore. -- Peter Geoghegan