From: beyond-mountains (@beyond-mountains) <noreply+beyond-mountains@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #1034: Performance regression: OR-idempotent equivalent filters cause up to 3.341x search latency difference
Date: Thu, 08 Oct 2026 12:40:15 +0000
Message-ID: <gh-pgvector-pgvector-1034-c6060071435@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-1034@github.com>
References: <gh-pgvector-pgvector-1034@github.com>
@ankane Thanks for the feedback.
To clarify, the issue is about the expected behavior of filtered vector similarity search, rather than necessarily attributing the regression to pgvector itself.
For example, consider the following query:
```sql
SELECT id
FROM efa_pgvector_full
WHERE <FILTER_EXPRESSION>
ORDER BY embedding <=> $1::vector
LIMIT 10;
```
**Expected behavior:**
Semantically equivalent filter expressions should select exactly the same eligible rows. When the query vector, dataset, HNSW index, `top_k`, and `hnsw.ef_search` remain unchanged, we would also expect comparable search performance and Recall@K, without unexpectedly large differences caused solely by the filter representation.
**Observed behavior:**
Replacing a range predicate (`age >= 1 AND age <= 300`) with its logically equivalent OR expression (`age = 1 OR ... OR age = 300`) resulted in a reproduced **3.600x difference in ANN search latency**, despite identical eligible row sets and Recall@K.
I understand that PostgreSQL's query planner and filter evaluation may contribute to this difference, so this may not necessarily be a pgvector-specific issue.
However, I believe this behavior is worth investigating in the context of filtered vector search. Would you consider this an expected consequence of PostgreSQL's query planning and expression evaluation, or something that could potentially be improved in pgvector?