Re: strange perf regression with data checksums

Peter Geoghegan <pg@bowt.ie>

From: Peter Geoghegan <pg@bowt.ie>
To: Tomas Vondra <tomas@vondra.me>
Cc: Aleksander Alekseev <aleksander@timescale.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-05-19T17:20:33Z
Lists: pgsql-hackers

Attachments

On Mon, May 19, 2025 at 12:42 PM Peter Geoghegan <pg@bowt.ie> wrote:
> We don't actually need to call BufferGetLSNAtomic() from _bt_readpage
> during index-only scans (nor during bitmap index scans). We can just
> not call BufferGetLSNAtomic() at all (except during plain index
> scans), with no possible downside.

Attached quick-and-dirty prototype patch shows how this could work. It
fully avoids calling BufferGetLSNAtomic() from _bt_readpage() during
index-only scans. I find that "meson test" passes with the patch
applied (I'm reasonably confident that this general approach is
correct).

Does this patch of mine actually fix the regressions that you're
concerned about?

-- 
Peter Geoghegan

Commits

  1. Make _bt_killitems drop pins it acquired itself.

  2. Avoid BufferGetLSNAtomic() calls during nbtree scans.

  3. Reduce pinning and buffer content locking for btree scans.