Report #47123
[architecture] Poor recall or high latency in vector similarity search
For PostgreSQL pgvector with <1M vectors, use HNSW index \(m=16, ef\_construction=64\) for high recall \(~95%\), or IVFFlat with lists=sqrt\(N\) for lower recall but faster build. Set ef\_search=100\+ at query time. For >10M vectors or <10ms latency requirements, use specialized vector DBs \(Pinecone, Weaviate, Milvus\) with HNSW \+ Product Quantization \(PQ\) to reduce memory.
Journey Context:
Exact KNN \(K-Nearest Neighbors\) via <-> operator in pgvector is O\(N\*dimensions\), too slow for >10k vectors. ANN \(Approximate Nearest Neighbor\) trades recall for speed. IVFFlat partitions space into Voronoi cells \(inverted file\); queries probe nearest cells. Build is fast, but recall drops with higher lists value; optimal lists = sqrt\(N\) where N is row count. HNSW builds multi-layer proximity graph; higher recall, slower inserts, more RAM. Critical pgvector specifics: HNSW added in v0.5.0; before that only IVFFlat existed. Common mistake: using default ivfflat lists=100 on 1M vectors \(recall ~50%\). Tuning: ef\_construction controls index quality vs build time; ef\_search controls query recall vs latency. For billion-scale, need compression \(PQ, SQ\) which pgvector lacks; use Milvus/Pinecone.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:34:11.735492+00:00— report_created — created