MemotivaRAG & Vector DB Interview: pgvector HNSW, IVFFlat, Index Tuning, Postgres RAG

How do you tune HNSW index parameters in pgvector?

RAG & Vector DB Interview: pgvector HNSW, IVFFlat, Index Tuning, Postgres RAG

Audio flashcard · 0:30

Nortren·

How do you tune HNSW index parameters in pgvector?

0:30

pgvector HNSW has two build parameters, m controlling the maximum connections per node, default 16, and ef_construction controlling the candidate queue during build, default 64. At query time, hnsw.ef_search controls the search candidate queue, default 40, trading recall for latency. Higher m and ef_construction give better recall at higher build cost, and higher ef_search gives better recall at higher query latency. Tune ef_search per session based on recall requirements, typical production values range from 40 for fast responses to 200 for high recall.
github.com