recallA retrieval
field guide

Choosing a Vector Database

Build this skill

Choose between libraries, pgvector, purpose-built and managed vector databases for a scenario.

Many good options, different strengths

There is no shortage of tools for storing and searching vectors, and new ones keep appearing. They fall into four families, and choosing the right family matters far more than choosing within one.

Food makes the families easy to remember. An embedded library is cooking in your own room. A database extension is the hostel mess you already eat at adding a new dish. A purpose-built database is a restaurant you run yourself. A managed service is a tiffin service: the food arrives, and someone else runs the kitchen.

Family Examples What it is
Embedded library FAISS, Chroma (in local mode) Runs inside your program; no separate server
Database extension pgvector for PostgreSQL Adds vectors to a database you already run
Purpose-built database Qdrant, Milvus, Weaviate A separate database designed around vector search
Managed service Pinecone; managed versions of the above Someone else runs the servers; you pay for usage

The families in brief

FAISS is extremely fast and has many index types, but no metadata storage, permissions or server of its own. Chroma is an open-source store with a very simple Python interface, popular for prototypes and small applications.

pgvector puts vectors in the same PostgreSQL database as the rest of your data, with the SQL, transactions, backups and access control you already understand.

Qdrant, Milvus and Weaviate offer filtering during the search itself, vector compression, and horizontal scaling (spreading data across many machines). Milvus was designed for very large deployments, and Weaviate has hybrid search built in. Each can be self-hosted or used as a managed cloud service.

Pinecone is fully managed. There are no servers to run and it scales automatically; in exchange you pay by usage, and your data lives in the provider's cloud.

pgvector / self-hosted Qdrantyou operate it; small to largeMilvus / Qdrant / Weaviate clustersyou operate it; very largeFAISS / Chromaprototypes, notebooks, batch jobsManaged serviceslarge scale, no servers to runscale and traffic →need to run it yourself →

A rough map: how much you want to operate yourself, against how large and busy the system will be.

Questions that decide the choice

Comparing feature lists rarely settles anything. Six questions about your own project usually do.

Question How the answer steers the choice
How many vectors, now and in two years? Thousands suit a library; millions suit pgvector or one database server; billions need a distributed database
Do you already run PostgreSQL? If so, pgvector saves you a whole system to operate
Can the data leave your servers? If not, managed cloud services may be ruled out
How complex are the filters and permissions? Heavy filtering favours SQL or a database with filter-aware indexes
Who will operate it? A small team with no database administrator may prefer a managed service
How often does the data change? Frequent updates and deletes need a real database, not a library

The program below turns four of these questions into a simple recommendation, to show the order in which they are usually asked.

python · runs in your browser

Expected output:

text
Weekend prototype, 5k FAQs                     -> Chroma or FAISS for a prototype; move to a database when updates and users arrive
College helpdesk on existing PostgreSQL, 2M    -> pgvector: one database for text, metadata and vectors
Hospital records search, data must stay, 80M   -> Self-hosted Qdrant, Milvus or Weaviate
SaaS start-up, no ops team, 30M                -> A managed vector database service

The function returns at the first condition that matches, so the order of the if lines is the order of the questions: scale first, then existing systems, then data rules and the team. recommend(*answers) unpacks each tuple of four answers into the four parameters. Add a scenario of your own and run it again.

Keeping the choice reversible

The store you pick today may not be the one you want in two years. To keep that change cheap, put the store behind a thin layer of your own code: the application calls add_chunks, delete_document and search, and never touches the store directly. Below, NumpyStore is a tiny but complete store, and answer_sources stands for the application.

python · runs in your browser

Expected output:

text
['Up to 10 days of medical leave.', 'Certificate within 7 days.']
['Gates close at 10 PM.']

answer_sources calls store.search and has no idea what kind of store it was given. Switching to pgvector later would mean writing a PgvectorStore class with the same three methods and loading the data into it; the rest of the application would stay as it is. It also helps to keep the original text and metadata in a system you control, and to record which embedding model produced each vector.

Follow your curiosity.

↑ ↓ to explore · Enter to open · Escape to close