Vector & Data Stores ★ 17.0k

pgvector

Vectors inside the Postgres you already run — the right answer until it is not.

pgvector keeps embeddings next to your relational data, which removes an entire distributed-systems problem for most applications. It handles millions of vectors comfortably; past that, evaluate a dedicated store honestly.

Best for: Millions-scale vectors with existing Postgres

Deploy: Self-hostable

What to do about it

  • Stores vectors in Postgres
  • Handles millions of vectors
  • Self-hosted and open-source

What it is

pgvector is a tool that stores vectors next to relational data in Postgres. It handles millions of vectors comfortably.

This means that pgvector keeps embeddings close to the data they are associated with, which can simplify certain applications.

Where it fits in a deployment stack

Vector databases like pgvector are used to solve problems that involve similarity searches or nearest neighbour queries. They are often used in conjunction with relational databases.

In a production system, a vector database would typically sit next to a relational database and take over the work of handling vector-based queries.

This can help to reduce the complexity of the system and improve performance.

How to evaluate it

To evaluate pgvector, you need to consider how it will be used in your application and what benefits it will bring. You should test it with your own data and use cases.

  • Feed it a dataset of 1 million vectors and measure the time it takes to build the index.
  • Inject a failure into the Postgres database and verify that pgvector can recover from it.
  • Inspect the output of a query that uses the vector index and verify that it is correct.
  • Measure the p95 latency of the retrieval step under 50 concurrent sessions.
  • Test the performance of pgvector with a mix of exact and approximate queries.
  • Verify that pgvector can handle a high volume of writes without significant performance degradation.

What to verify before you commit

Before you commit to using pgvector, there are several things you need to verify. You should check the licence terms and ensure that they are compatible with your application.

  • Check the licence terms to ensure they allow for commercial use.
  • Verify that pgvector handles data encryption and access controls correctly.
  • Estimate the operational cost of running pgvector and ensure it fits within your budget.
  • Test the failure behaviour of pgvector and ensure it meets your requirements.
  • Check for any potential lock-in and ensure that you can migrate to a different solution if needed.
  • Verify that pgvector supports the Postgres version you are using.

Where this fits in the FDE path

Recommended kits

RAG in Production Playbook

Chunking strategies, reranking setups, evaluation harnesses and the seven failure modes that kill every RAG demo in week three.