azyware
RAG & knowledge engineeringTool / technology

pgvector

Also: PostgreSQL vector extension

In one sentence

What is pgvector?

pgvector is an open-source PostgreSQL extension that stores embeddings as a native column type and supports indexed similarity search, letting teams run vector retrieval inside the database they already operate.

What pgvector means

pgvector adds a vector data type to PostgreSQL along with distance operators (cosine, Euclidean, inner product) and approximate nearest-neighbour indexes (HNSW and IVFFlat). An embedding sits in a column next to the row's ordinary fields, so a single SQL query can combine similarity ranking with filters on tenant, date, status or permissions, and even with full-text search for hybrid retrieval.

It is available on most managed PostgreSQL services (AWS RDS and Aurora, Google Cloud SQL, Azure, Supabase, Neon), which means no new infrastructure, no second store to keep in sync with the system of record, and the same backups, roles and row-level security you already have. For corpora into the low millions of vectors it performs well enough for interactive use with proper indexing.

pgvector is not a full vector database product: it lacks some features of dedicated systems (built-in sharding across nodes, some quantisation options, managed re-indexing) and very large or very high-throughput workloads may outgrow it. It is a pragmatic default, not a universal answer.

Who it really matters to

  • CTO / Head of Engineering: One fewer system to secure, back up and monitor; the same transactions cover business data and vectors.
  • CISO: Vectors stay inside your existing database perimeter and residency arrangement rather than a new SaaS vendor.
  • CFO: No additional managed-service bill for moderate workloads; cost is incremental storage and compute on Postgres you already pay for.
  • Data lead: Joins between vectors and relational data happen in SQL, which simplifies permission filtering and analytics.

Why it exists

Early RAG projects defaulted to a dedicated vector store because that was where the tooling was, which added a second source of truth to sync, secure and pay for. pgvector exists to make vector search a feature of the relational database rather than a separate product, so retrieval and business data live and move together. The trade-off is scale and specialised features: at tens of millions of vectors or extreme query rates, a purpose-built system may be justified. For most business applications that point is far away, and starting in Postgres keeps options open.

Where it is applied

  • Multi-tenant SaaS copilot where tenant ID filtering and vector search run in one query with row-level security
  • NBFC policy assistant hosted on the bank's existing RDS instance to satisfy data-localisation requirements
  • Product similarity for a mid-size retailer's catalogue without adding a new managed service
  • Hospital knowledge assistant on self-managed Postgres inside the hospital network
  • Semantic search over shipment notes for a logistics platform already running on PostgreSQL

Is pgvector a skill?

Tool / technologyAn open-source database extension. Eazyware's Retrieval & Knowledge Engineering team uses it as the default vector store for new builds and benchmarks it against managed alternatives when a client's scale or latency needs suggest otherwise.

Eazyware service that covers it: Retrieval & Knowledge Engineering. Starting prices are on the pricing page.

Frequently asked questions

How large a corpus can pgvector handle?

With HNSW indexing and adequate memory, single-node Postgres serves interactive queries comfortably into the low millions of vectors. Beyond that, or under very high query rates, benchmark against a dedicated store before committing.

Does pgvector support hybrid search?

Yes, in combination with PostgreSQL's built-in full-text search. Both can run in one query and be fused in SQL or application code, giving keyword and semantic retrieval from a single database.

Related reading

Need pgvector built, not just explained?

PRJECT IN MIND?