pg.ddx.io pgvector/pgvector GitHub issues and pull requests
help / color / mirror / Atom feedFrom: beyond-mountains (@beyond-mountains) <noreply+beyond-mountains@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #1034: Performance regression: OR-idempotent equivalent filters cause up to 3.341x search latency difference
Date: Tue, 29 Sep 2026 07:49:07 +0000
Message-ID: <gh-pgvector-pgvector-1034@github.com> (raw)
# Performance regression: OR-idempotent equivalent filters cause up to 3.341x search latency difference
## Summary
Equivalent representation: `F ↔ F OR F OR ... (e.g., x=1 ↔ x=1 OR x=1 OR ...)`
Semantically equivalent filters showed a reproduced client end-to-end ANN latency ratio above 2.0x.
Discovery candidates: 9; reproduced configurations: 9.
## Environment
- Backend: PostgreSQL + pgvector
- Database version: PostgreSQL 15.17 (Debian 15.17-1.pgdg12+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14+deb12u1) 12.2.0, 64-bit; pgvector 0.8.2
- Container limit: 8 physical CPU cores, 32 GiB memory
- Dataset: 200000 points, 128 dimensions, correlation=0.85
- HNSW: M=16, efConstruction=128
## Metadata schema and distribution
All listed fields are present and non-null for every pgvector row.
|Field|Type|Domain / generation|
|---|---|---|
|`id`|INT64|Unique sequential ID in `[0, 199999]`|
|`tenant`|INT64|Discrete uniform sample from `[0, 99]`|
|`level`|INT64|Discrete uniform sample from `[0, 31]`|
|`category`|INT64|`tenant + 1`; finite domain `[1, 100]`|
|`category5`|INT64|`tenant % 5 + 1`; finite universe `{1,2,3,4,5}`|
|`age`|INT64|Discrete uniform sample from `[1, 1000]`|
|`parity`|STRING/keyword|`even` when tenant is even, otherwise `odd`|
Vectors are generated around a tenant-specific center with vector/tenant correlation parameter `0.85`; `level` and `age` are sampled independently of tenant. Category, category5, and parity are deterministic functions of tenant.
PostgreSQL B-tree indexes are present on tenant, level, category, category5, age, and parity.
For the strongest case below, the filter selects 3992 / 200000 points (observed selectivity `1.9960%`). The semantic oracle enumerated and directly compared the complete eligible ID sets.
## Strongest reproduced case
- Pattern: OR-idempotent; expression scale=128, K=10, ef_search=16
Original filter:
```sql
(category = 1) OR (category = 2)
```
Equivalent filter, abbreviated:
```text
((category = 1) OR (category = 2)) repeated 128 times with OR
```
```python
original_filter = "(category = 1) OR (category = 2)"
equivalent_filter = " OR ".join(f"({original_filter})" for _ in range(128))
```
- Semantic oracle: equal=True, eligible count=3992
- ANN p50: 0.9775 ms vs 3.2658 ms; symmetric ratio=3.341x; equivalent/original=3.341x
- Exact p50: 75.2951 ms vs 880.8820 ms; ratio=11.699x
- Recall: 0.7750 vs 0.7750; gap=0.0000
- Exact Top-K identical: True
view thread (4+ messages) latest in thread
Message-ID: <gh-pgvector-pgvector-1034@github.com>
Permalink: ../gh-pgvector-pgvector-1034@github.com/
·
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox