PostgreSQL pgvector

pgvector Monitoring and Tuning for Production RAG

pgvector runs underneath most production Postgres RAG stacks in 2026. Default HNSW parameters silently drop recall to 67% on high-dimensional embeddings. This hub explains what to watch, how to measure recall honestly, and how to tune the index without dropping production queries.

Search Topics This Page Covers

pgvector monitoringpgvector recall measurementpgvector hnsw indexpgvector ef_construction ef_searchpgvector production ragpgvector index tuningpostgres vector search monitoring

Signals Worth Watching

Silent recall drop: HNSW returns wrong top-K results without any error or plan anomaly.

Immutable parameters: m and ef_construction cannot be ALTERed — a wrong choice means a full rebuild.

Build-time spikes: parallel HNSW builds eat maintenance_work_mem; watch pg_stat_progress_create_index.

Index bloat after heavy updates: pgvector indexes do not compact on update, only on REINDEX.

Dimension drift: a silent embedding-model swap can mix vector dimensions in the same column.

Practical PostgreSQL Checks

Inspect current HNSW index configuration

Returns the index name and WITH-options row (m, ef_construction). If the output is empty the table has no HNSW index; if reloptions is NULL the index was built with pgvector defaults.

SELECT i.indexname, c.reloptions
FROM pg_indexes i
JOIN pg_class c ON c.relname = i.indexname
JOIN pg_am am ON am.oid = c.relam
WHERE i.schemaname = 'public'
  AND i.tablename  = 'doc_embeddings'
  AND am.amname    = 'hnsw';

Watch live CREATE INDEX progress

HNSW builds are the main reason pgvector index operations feel slow. Parallel build lands in pgvector 0.7+; older versions show a single-phase progress bar and run an order of magnitude slower.

SELECT phase, tuples_done, tuples_total,
       round(100.0 * tuples_done / NULLIF(tuples_total,0), 1) AS pct
FROM pg_stat_progress_create_index;

Sample recall@10 against exact k-NN

Full working query lives in the blog post; run it quarterly or after major data changes. Below 0.85 recall means your RAG returns wrong context on roughly one in every seven queries.

-- Disable the HNSW path for the exact CTE with
-- SET LOCAL enable_indexscan = off; to force a sequential scan
-- and measure the ground truth before comparing to approximate.

How MonPG Helps

First-class pgvector inventory: vector columns, indexes, WITH options, live build progress in one dashboard.

HNSW Tuning Lab: one-click benchmark that sweeps 48 configurations and returns a zero-downtime migration SQL.

Recall drop alerts on scheduled re-benchmarks (Scale tier).

Works against self-hosted Postgres, Supabase, Neon, AWS RDS / Aurora, GCP AlloyDB / Cloud SQL, Azure Database.

Related PostgreSQL Guides

Documentation for This Topic

Hands-on setup, integration, and troubleshooting guides from the MonPG product docs.

Browse all documentation →

PostgreSQL Tools

Related Topic Hubs

Monitor PostgreSQL before tuning turns into firefighting.

MonPG gives teams query history, alerts, index guidance, vacuum visibility, replication signals, and cloud PostgreSQL monitoring in one place.

Start free