Backendcore
Postgres + pgvector
Vectors in the same database as your data: joins, filters, transactions and row-level security for free.
What it is and why it exists
pgvector adds a vector type, distance operators (<-> L2, <=> cosine, <#> inner product) and HNSW / IVFFlat indexes to Postgres. You get one system for metadata filters, permissions, transactions and vectors, which is often simpler than a separate vector database up to tens of millions of vectors.
Quick prototype
CREATE EXTENSION vector; a table with an embedding column; ORDER BY embedding <=> $1 LIMIT 5.
In production, at scale
HNSW index with tuned m / ef_construction and hnsw.ef_search, filtered search with iterative index scans or partial indexes per tenant, halfvec to cut memory, hybrid search with Postgres full-text and RRF in SQL, connection pooling, and RLS for tenants.
Vendors and tools
| pgvector | The extension |
|---|---|
| Supabase / Neon / Timescale (pgvectorscale) | Hosted Postgres with vectors |
| ParadeDB | BM25 inside Postgres |
On AWS: Aurora PostgreSQL and RDS for PostgreSQL support pgvector; Bedrock Knowledge Bases can use Aurora as the vector store.
How it fails
- Filtered queries returning too few rows because the HNSW scan stops early
- Index build eating all memory (maintenance_work_mem)
What the interviewer asks next
pgvector or a dedicated vector DB?
pgvector when you want vectors next to relational data, transactions and RLS at modest scale. A dedicated store when you need very large scale, heavy filtered ANN, or features like built-in hybrid and multi-tenancy at scale.