RAG with Postgres and pgvector in production: from PoC to SLO
Embeddings, HNSW indexing, reranking, evaluation, context window, latency under load. Full stack with code and measurable SLOs.
Tag
Embeddings, HNSW indexing, reranking, evaluation, context window, latency under load. Full stack with code and measurable SLOs.
This guide installs PostgreSQL 18.6 with pgvector 0.8.7 on Debian or Ubuntu from the PGDG repository, creates a dedicated role and database, tunes memory, builds an HNSW index and checks it with EXPLAIN. Version 0.8.7 fixes CVE-2026-103484, a buffer overflow in IVFFlat index builds.
pgvector matured in 2023-2024 with the HNSW index type and parallel construction that arrived in version 0.6. For projects already running PostgreSQL, a dedicated vector database is not needed in most cases: this guide explains when PostgreSQL is enough, how to configure the index, and where it starts to fall short.