On Mon, May 19, 2025 at 2:19 PM Peter Geoghegan <p...@bowt.ie> wrote: > On Mon, May 19, 2025 at 2:01 PM Tomas Vondra <to...@vondra.me> wrote: > > The regular index scan however still have this issue, although it's not > > as visible as for IOS. > > We can do somewhat better with plain index scans than my initial v1 > prototype, without any major difficulties. There's more low-hanging > fruit. > > We could also move the call to BufferGetLSNAtomic (that currently > takes place inside _bt_readpage) over to _bt_drop_lock_and_maybe_pin. > That way we'd only need to call BufferGetLSNAtomic for those leaf > pages that will actually need to have some index tuples returned to > the scan (through the btgettuple interface).
Attached is v2, which does things this way. What do you think? v2 also manages to avoid calling BufferGetLSNAtomic during all bitmap index scans. You didn't complain about any regressions in bitmap index scans, but I see no reason to take any chances (it's easy to just not call BufferGetLSNAtomic there). -- Peter Geoghegan
v2-0001-Avoid-BufferGetLSNAtomic-calls-during-nbtree-scan.patch
Description: Binary data