pgvector
Vector similarity search inside PostgreSQL. pgvector is an open-source PostgreSQL extension that stores embeddings as a column type and searches them by similarity. It supports exact search and approximate indexes such as HNSW and IVFFlat. It lets teams build retrieval-augmented generation and semantic search without adding a separate vector database.
When it is the right choice
- You already run PostgreSQL and want vector search next to your existing data
- You need to filter vector results by normal columns such as tenant, date or permissions
- Your collection size is in the range a well-tuned Postgres handles comfortably
- Consider a dedicated vector store only if you outgrow Postgres after measuring, not before
How we use it
- Design schemas that keep embeddings, source text and access rules together
- Choose and tune indexes against real queries, measuring recall and latency
- Run pgvector on managed Postgres such as RDS or Cloud SQL, or on Kubernetes with backups and replicas
- Monitor query times and re-embed content automatically when the embedding model changes
Related articles
Database Deployment Automation: Shipping Schema Changes Without the Quiet-Hours RitualDatabase deployment automation in practice: versioned migrations, expand and contract, lock-safe changes, a migration job in the pipeline, and a review step that reads every schema change before it runs.
Database Backup and Restore Testing: The Backup You Have Never RestoredDatabase backup best practices start with the restore. How we test PostgreSQL and MySQL restores on a schedule, measure recovery time, and know the backups work before we need them.
Fine-Tuning or Prompting? A Decision Guide for Small TeamsWhen prompting, RAG or fine-tuning is the right way to adapt a language model, and what each one costs a small engineering team.pgvector: frequently asked
Do we need a separate vector database for RAG?
Often not. pgvector handles many RAG workloads well and keeps your stack simpler. We measure performance with your data before recommending anything else.
Is pgvector available on managed Postgres?
Yes, the major managed services, including Amazon RDS, Aurora, Google Cloud SQL and Azure Database for PostgreSQL, offer it. Check which extension version your service supports.
Running pgvector, or deciding whether to? Tell us what you have; the first consultation is free.
Let's talk »