Production pgvector Performance Review
Vector-search performance is a database trade-off problem too: recall, latency, memory, index build cost, metadata filters and the relational workload around the vector search.
Vector-search performance is a database trade-off problem too: recall, latency, memory, index build cost, metadata filters and the relational workload around the vector search.
Choose and tune based on workload, recall/latency target, update pattern and operational constraints—not popularity.
Investigate metadata selectivity, query shape and vector-index interaction when filters destroy expected latency.
Understand index build/maintenance cost, memory pressure and the effect of growth on vector workload behavior.
Start with the HNSW versus IVFFlat benchmark guide. The semantic search API guide covers the application architecture and production checks. On 0.8.6 or earlier, read the pgvector 0.8.7 security fix guide first.
A vector index is only one access path the PostgreSQL planner can choose. The plan, not the index definition, decides what the query actually does.
ORDER BY embedding <op> $1 LIMIT k, with the distance operator matching the index operator class (for example <=> with vector_cosine_ops). An expression around the distance, a descending sort or a missing LIMIT means no index scan.hnsw.ef_search of 40 and a filter matching 10% of rows, pgvector's documentation notes only about four rows survive on average. The query asked for ten and returns fewer, quickly.hnsw.iterative_scan and ivfflat.iterative_scan let a filtered query keep scanning until enough rows match, bounded by settings such as hnsw.max_scan_tuples. That improves result count at a latency cost that needs measuring.The evidence is EXPLAIN (ANALYZE, BUFFERS) for representative filtered queries, the returned row count against the requested k, and recall against an exact-search baseline. The filtered-search lab measures each fix on one dataset.
maintenance_work_mem. PostgreSQL logs a notice when it no longer fits, and the build slows sharply from that point. Raising the setting has to leave memory for the rest of the server.rows / 1000 lists up to a million rows and sqrt(rows) above that. After heavy growth or distribution shift, recall can drift until the index is rebuilt.vector indexes support up to 2,000 dimensions and halfvec up to 4,000. Half precision halves storage and index size; measure its recall effect before switching.Version-specific details from the pgvector documentation (0.8.x), checked 13 October 2026. Managed services may ship an older pgvector; check SELECT extversion FROM pg_extension WHERE extname = 'vector'; first.
Bring the workload shape, vector/index configuration and query behavior. The first step is deciding whether a focused review is justified.
Prefer to talk first? Book a 20-minute triage call.