YOUR AD GOES HERE

I asked Postgres for 10 results. 66% of the time it returned none.

Published 24, Oct 2026

Data Engineering With AI


Description:
I asked Postgres for 10 results. With a filter that matches 1% of rows, 66% of my 1,000 queries returned none.

Our own test (Oct 22, 2026): pgvector 0.8.5 on PostgreSQL 18.4, one laptop. 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. No error and no warning came back.

Results (1,000 queries each): no filter, 10 rows every time. A filter matching 10% of rows, 3.83 rows on average. A filter matching 1%, 0.40 rows on average; 660 queries returned zero rows and none returned 10.

This is documented, not a bug. pgvector's README: "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.

Scope: 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.

Script written with an AI model made by Anthropic. Voice and visuals AI-generated; the numbers are from our own run.

Source for the quote: https://github.com/pgvector/pgvector (README, Filtering)

More: dataeng.ai

Releted More Videos

  • Sorry!!! Nothing to show

You May Also Like

YOUR AD GOES HERE

YOUR AD GOES HERE