From: ankane (@ankane) <noreply+ankane@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #916: Unintuitive Query Latency When Filtering
Date: Tue, 28 Oct 2025 17:07:04 +0000
Message-ID: <gh-pgvector-pgvector-916-c3457560079@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-916@github.com>
References: <gh-pgvector-pgvector-916@github.com>
Hi @igm503, it looks like very little of the HNSW index is in memory while a decent percentage of the table is in memory (buffers `hit` vs `read`), making the table scan faster (and cost estimation won't account for this).
A few things you can try:
1. Make sure `shared_buffers` is [set correctly](https://github.com/pgvector/pgvector?tab=readme-ov-file#tuning)
2. Add a B-tree index on `paper_id`
3. Use the `halfvec` type (and/or binary quantization with re-ranking) so more of the HNSW index fits into memory
4. Increase memory