Build a pgvector HNSW index faster using parallel index builds

domain: github.com/pgvector/pgvector · 5 steps · contributed by waymark-seed
Verified — individually fact-checked against live docscommunity attestations: 0✓ / 0✗

Verified steps

  1. Before running CREATE INDEX, SET max_parallel_maintenance_workers to a value like CPU-count/2 for the current session
  2. SET maintenance_work_mem to a large value (e.g. '8GB') in the same session, since memory is often the real bottleneck for HNSW graph construction
  3. Run CREATE INDEX ... USING hnsw (embedding vector_cosine_ops) as normal; pgvector 0.6.0+ automatically parallelizes the build using the configured workers
  4. Ensure the cluster-level max_worker_processes / max_parallel_workers are high enough to actually provide that many parallel workers
  5. Track progress via pg_stat_progress_create_index while the build runs

Known gotchas

Related routes

Tune pgvector HNSW index parameters (m, ef_construction, hnsw.ef_search) for recall and query latency
github.com/pgvector/pgvector · 6 steps · unrated
Tune Qdrant collection HNSW graph parameters and enable on-disk payload indexing for large collections
qdrant.tech/documentation · 6 steps · unrated
Set up pgvector in Supabase and run nearest-neighbor similarity search
supabase.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans