[Patch] Make ginInsertCleanup follow vacuum's BufferAccessStrategy

From: "Kevin Rocker" <me(at)kevinrocker(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [Patch] Make ginInsertCleanup follow vacuum's BufferAccessStrategy
Date: 2026-08-18 22:42:31
Message-ID: 76104756-9ca6-45ee-bd16-ead325f1c149@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The vacuum callers of ginInsertCleanup weren't able to pass the current BufferAccessStrategy, since the function didn't take a strategy argument. I modified the function to take a strategy, and passed it from the vacuum down to ReadBufferExtended. Other call-sites pass NULL as a strategy, which preserves the current behavior.

I did notice 6c228755add, which uses ReadStream in ginvacuumcleanup()'s full-index scan, but I don't think that will work here: that scan knows the full block range, but the pending-list needs to read each page to get the next block.

Running a quick test (script attached), we do see the strategy changing how GIN treats the buffer cache. I originally noticed this as just an inconsistency, but it may be a good improvement to how GIN vacuum interacts with shared buffers (fewer evictions on other processes).

- Kevin Rocker

Attachment Content-Type Size
v1-0001-Use-the-vacuum-buffer-access-strategy-in-GIN-pend.patch text/x-patch 6.4 KB
gin-pending-strategy-test.sql application/sql 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message surya poondla 2026-08-18 23:38:37 Re: pg_xmin_horizon: a system view of everything pinning the xmin horizon
Previous Message Michael Paquier 2026-08-18 22:38:31 Re: [PATCH] Several refactorings for pg_dump