From: YidaWeng (@YidaWeng) <noreply+YidaWeng@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #1063: Switched to TidStore for HNSW vacuuming for Postgres 17+
Date: Fri, 13 Nov 2026 06:46:30 +0000
Message-ID: <gh-pgvector-pgvector-1063-c6846241384@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-1063@github.com>
References: <gh-pgvector-pgvector-1063@github.com>
Thanks, I missed `hnsw-tidstore2` — closing this.
A few things I hit while testing that branch, in case they are useful for it:
1. `TidStoreSetBlockOffsets()` is called even when `ndeletedoffs == 0`, which trips `Assert(num_offsets > 0)` in assert-enabled builds. A `ndeletedoffs > 0` guard fixes it.
2. `TidStoreCreateLocal()` takes bytes, but the branch passes the GUC value in kB, so the limit ends up 1024x too small.
3. Using TidStore unconditionally regresses high-dimensional indexes. With `vector(1536)` a page holds one element, so the per-page bitmap costs more than the hash entries: at 50k rows, 10% deleted went from 88 KB to 248 KB and 50% deleted from 280 KB to 584 KB. I only use TidStore when a page can hold at least 4 element tuples (estimated from the entry point tuple) and keep the hash table otherwise.
With that gate, 1M rows at 50% deleted: 3d 8216 KB -> 1472 KB, 128d 8216 KB -> 3008 KB, and 1536d unchanged. Full VACUUM time and peak RSS were neutral. More numbers are in the PR description if they are helpful.