---
title: "pgvector: 30x Faster Index Build for your Vector Embeddings"
description: "pgvector 0.6.0 adds parallel builds for HNSW indexes, cutting build time by up to 30x in benchmarks on 10M 1,536-dimension vectors using a 64 vCPU, 512GB instance."
url: "https://swe.quest/articles/pgvector-30x-faster-index-build-for-your-vector-embeddings-cd6dabfa49eb13de"
canonical: "https://neon.com/blog/pgvector-30x-faster-index-build-for-your-vector-embeddings"
source: "Neon"
published: "2024-02-07"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 6
tags: ["vector-search","postgres","performance"]
---

# pgvector: 30x Faster Index Build for your Vector Embeddings

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-02-07, 6 min read, Announcement. Original: [https://neon.com/blog/pgvector-30x-faster-index-build-for-your-vector-embeddings](https://neon.com/blog/pgvector-30x-faster-index-build-for-your-vector-embeddings)

## Summary

pgvector 0.6.0 adds parallel builds for HNSW indexes, cutting build time by up to 30x in benchmarks on 10M 1,536-dimension vectors using a 64 vCPU, 512GB instance. Recall is essentially unchanged, with most results shifting slightly upward. Fast builds depend on giving the graph enough memory: raise maintenance\_work\_mem (for example to 8GB) so the graph fits, and raise max\_parallel\_maintenance\_workers above the default of 2. On Neon, which currently supports pgvector 0.5.1 with 0.6.0 coming, compute can be scaled up for the build and back down afterward, avoiding permanent over-provisioning just for indexing.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- PostgreSQL indexes ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- vector embeddings ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- approximate nearest neighbor search ([easy posts on Search](https://swe.quest/tags/search.md?difficulty=easy))

## Keywords

pgvector, HNSW, Neon, IVFFlat, maintenance\_work\_mem, max\_parallel\_maintenance\_workers

## Related posts

- [pgvector 0.6.0: 30x faster with parallel index builds](https://swe.quest/articles/pgvector-0-6-0-30x-faster-with-parallel-index-builds-e5dea50876a1e20f.md): Supabase · 2024-01-30 · Medium · 3 min read · Vector search, PostgreSQL, Performance engineering
  pgvector 0.6.0 adds parallel HNSW index builds, cutting build time for 1M 1536-dimension vectors (dbpedia OpenAI dataset, m=16, ef\_construction=200) from about 1h27m to 9.5 minutes.
- [RAG With Autoscaling: Better Performance With Lower Costs For pgvector](https://swe.quest/articles/rag-with-autoscaling-better-performance-with-lower-costs-for-pgvector-52ce2e1857682b4f.md): Neon · 2024-08-27 · Medium · 4 min read · Vector search, PostgreSQL, Capacity planning, RAG & retrieval, Cost optimization
  Neon's autoscaling lets a Postgres instance scale up temporarily for the heavy memory and CPU demands of pgvector HNSW index builds, then scale back down, instead of being permanently overprovisioned.
- [pgvector v0.5.0: Faster semantic search with HNSW indexes](https://swe.quest/articles/pgvector-v0-5-0-faster-semantic-search-with-hnsw-indexes-d1e5c38ac44f551e.md): Supabase · 2023-09-06 · Medium · 6 min read · Vector search, PostgreSQL, Performance engineering, Algorithms
  pgvector v0.5.0 adds HNSW indexes, which combine skip-list-style layering with navigable small world proximity graphs to do approximate nearest-neighbor search over embeddings.
- [20x faster than pgvector: introducing pg\_embedding extension for vector search in Postgres and LangChain](https://swe.quest/articles/20x-faster-than-pgvector-introducing-pg-embedding-extension-for-vector-search-058737fc9388f495.md): Neon · 2023-07-11 · Medium · 7 min read · Vector search, PostgreSQL, Performance engineering
  pg\_embedding brought HNSW graph-based approximate nearest neighbor indexing to Postgres.
- [Understanding vector search and HNSW index with pgvector](https://swe.quest/articles/understanding-vector-search-and-hnsw-index-with-pgvector-db3498f2e1e5486e.md): Neon · 2023-09-20 · Medium · 10 min read · Vector search, PostgreSQL, LLMs
  pgvector 0.5.0 adds an HNSW (Hierarchical Navigable Small Worlds) index for approximate nearest neighbor search in Postgres, replacing O(N) sequential exact scans with a multi-layer graph traversal that trades a little accuracy for much faster queries.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
