From: cxyybless (@cxyybless) <noreply+cxyybless@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #975: HNSW inserts can spend a long time on BufferIO after VACUUM due to insertPage rewinding to old reusable pages
Date: Thu, 02 Apr 2026 06:53:00 +0000
Message-ID: <gh-pgvector-pgvector-975@github.com> (raw)
Hi,
We are seeing a reproducible HNSW write-side latency issue that mainly shows up as `BufferIO` waits after `VACUUM` on a large index.
For a large HNSW index, concurrent inserts after `VACUUM` can spend a long time waiting on `BufferIO` in `AddElementOnDisk()` / `ReadBufferExtended()`.
From code reading and production observation, my current hypothesis is:
- `VACUUM` identifies old reusable holes and effectively rewinds insertion toward old pages
- subsequent inserts start probing from those old reusable pages
- those pages are often cold / not resident
- many backends converge on the same cold region
- one backend starts buffer read I/O, and others block on the same buffer with `BufferIO`
So this looks less like pure lock contention and more like **repeated convergence on cold reusable pages after vacuum**.