I asked Postgres for 10 results. With a filter that matches 1% of rows, 66% of my 1,000 queries returned none. No error came back. No warning came back. The query ran fine and returned an empty list.
The 37-second reel: pgvector returned zero rows, silently.
The test
Our own test, run Oct 22, 2026, on one laptop: pgvector 0.8.5 on PostgreSQL 18.4. 100,000 random 128-dimension vectors, an HNSW index (m 16, ef_construction 64), default settings (hnsw.ef_search 40, iterative_scan off), 1,000 random query vectors, each asking for the 10 nearest rows with a filter. The query plan used the HNSW index and applied the filter after it.
What came back
Each row below is 1,000 queries, each asking for 10 rows:
| Filter | Average rows returned | Queries returning zero rows |
|---|---|---|
| None | 10 | 0 |
| Matches 10% of rows | 3.83 | not reported |
| Matches 1% of rows | 0.40 | 660 |
On the 1% filter, 660 queries returned zero rows and none returned 10.
Why it happens
This is documented, not a bug. pgvector’s README says: “If a condition matches 10% of rows, with HNSW and the default hnsw.ef_search of 40, only 4 rows will match on average.” Filtering runs after the index search, so 40 candidates at 10% leaves about 4. At 1%, 40 candidates leave about 0.4, which is what we measured.
The fixes we measured
Turning on iterative scan (pgvector 0.8.0 and later, hnsw.iterative_scan set to strict_order or relaxed_order) returned 10 rows for every query. The cost: median time on the 1% filter went from 0.5 ms to 10.2 ms with strict_order, or 7.8 ms with relaxed_order, about 15 to 20 times slower.
A bigger ef_search (400) fixed the 10% filter, returning 10 rows, but not the 1% filter, which still averaged 3.95 rows. The README also lists partial indexes and partitioning as options.
The fix
Check the row count in your search code. Assert len(results) equals k, and log the shortfall for each filter. That is our reading, untested: the failure mode here is silent, so the defense has to be a check on the output, not a hope that the index returns what you asked for. If you need the full 10 rows every time, iterative scan does it, at 15 to 20 times the latency on a selective filter.
What we did not verify
One library, one index type, random vectors, a filter unrelated to them, one machine. Real data and filters will differ, so measure yours. We did not test other vector databases, other pgvector versions, managed Postgres, concurrent load, or cold cache. A second dataset re-run confirmed the pattern: 718 of 1,000 queries returned zero rows on the 1% filter, with average rows of 4.19 at 10% and 0.33 at 1%. The voiceover in the reel is AI-generated. Watch the reel on Threads or YouTube Shorts.
This post started as an Instagram post →
- https://www.instagram.com/reel/De2688IE-_h/
- https://www.threads.com/@dataeng.ai/post/De3A7A2D6xG
- https://www.youtube.com/shorts/iweGPr6CoXs
- https://github.com/pgvector/pgvector
Numbers above trace to these sources. If one moved, tell us and we fix it.


Talk it through
Argue with us on Instagram.