Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 36 ยท Getting Started

The Vector Database Landscape

Compare vector search libraries, database extensions and dedicated vector databases such as FAISS, pgvector, Qdrant, Milvus, Weaviate, Chroma and Pinecone, and learn how to choose.

There are dozens of products that can do vector search, and new ones appear every few months. Rather than memorising names, learn the categories and the questions that decide between them. Names change, the trade-offs do not.

Read-only lesson. None of these products runs inside this site. The snippets below are illustrations of typical APIs: they were written from the products' public documentation and are labelled read-only. The one thing you can run here is a small decision helper at the end.

Three categories

Libraries

FAISS, hnswlib In-process index. You manage storage.
Fastest start No server, no network hop.

Great for research and embedded use.

1 / 3

1. Libraries

A library gives you an index object you build in memory and query in your own process. FAISS (Meta), hnswlib, Annoy and ScaNN are the best-known. They have no concept of users, metadata filters or durability beyond "save the index to a file". You write that layer yourself.

Python
# Read-only: FAISS is not available in the in-browser runner.
import faiss, numpy as np

xb = np.random.random((100_000, 128)).astype("float32")
index = faiss.IndexHNSWFlat(128, 32)      # HNSW graph, 32 links per node
index.add(xb)
distances, ids = index.search(xb[:3], 5)  # 5 nearest neighbours for 3 queries

Choose a library when you want maximum control or speed inside one application, and your data is a static or batch-built set.

2. Extensions to databases you already run

If you already run PostgreSQL, pgvector adds a vector column type and ANN indexes. You keep transactions, joins, backups and permissions, and your chunks live in the same row as their metadata.

SQL
-- Read-only: needs PostgreSQL with the pgvector extension.
CREATE EXTENSION vector;
CREATE TABLE chunks (
  id bigserial PRIMARY KEY,
  doc_id text,
  body text,
  embedding vector(768)
);
CREATE INDEX ON chunks USING hnsw (embedding vector_cosine_ops);

SELECT id, body
FROM chunks
WHERE doc_id = 'handbook'
ORDER BY embedding <=> '[0.01, -0.02, ...]'   -- cosine distance
LIMIT 5;

Elasticsearch, OpenSearch, MongoDB Atlas, Redis, SQLite extensions and many others have similar features. This is often the right answer for a first production system: fewer moving parts.

3. Dedicated vector databases

Qdrant, Milvus, Weaviate, Pinecone, Chroma and others are built around vector search. They offer fast filtered ANN, sharding, replication, multiple vectors per record, hybrid search and managed cloud options.

Python
# Read-only: requires the chromadb package and its dependencies.
import chromadb

client = chromadb.Client()
col = client.create_collection("handbook")
col.add(ids=["a", "b"], documents=["Refund policy ...", "Shipping times ..."])
print(col.query(query_texts=["Can I return an item?"], n_results=1))

Chroma embeds text for you with a default model; others expect you to send vectors. Always check which one you have.

What actually decides the choice

Question Why it matters
How many vectors, now and in two years? Thousands: anything. Tens of millions: ANN with care. Billions: sharding, disk indexes, quantization.
Do you need joins and transactions with other data? Favours pgvector and friends.
How heavy is metadata filtering? Some engines slow down badly with selective filters (production patterns).
Updates and deletes per second? Some indexes are expensive to update.
Self-host or managed? Operations cost versus vendor lock-in.
Hybrid (keyword + vector) search needed? Built in for some, bolt-on for others.
Latency budget and recall target? Decides index type and RAM (ANN lessons).
Multi-tenant isolation? Per-tenant collections versus filters.

A rule of thumb that survives most product changes: start with the simplest thing that fits (NumPy or your existing database), measure, and move up only when a measured limit appears.

Memory is the first limit

A vector index usually lives in RAM. You can estimate the footprint before you pick anything. Raw storage is vectors ร— dimensions ร— bytes per number, and graph indexes add overhead on top.

Python Estimate memory for your corpus

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Here the 5 million vector wiki needs about 15 GB raw. That fits one machine but not a laptop. Compression (quantization) shrinks it roughly four-fold.

A small decision helper

Turn the rules of thumb into code to see how they combine. This is a teaching toy, not an oracle.

Python Which category should I start with?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Avoiding lock-in

  • Keep the original text and metadata in your own store; the vector database should be rebuildable from it. You will re-embed when you change models anyway.
  • Wrap the store in a small interface (upsert, query, delete) like the TinyVectorStore in the overview.
  • Record the embedding model name and version alongside every vector.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which category gives you an in-process index but no built-in server, filters or durability?

    Libraries give you the index structure; storage, metadata and operations are your responsibility.
  2. 2. Why is pgvector often a good first production choice?

    Fewer moving parts is a big operational win until measured limits push you elsewhere.
  3. 3. A corpus has 5 million vectors of 768 float32 numbers. About how much raw memory is that?

    5,000,000 x 768 x 4 bytes is roughly 15.4 GB, before index overhead.
  4. 4. What should you store outside the vector database to avoid lock-in?

    With the source text you can re-embed and rebuild the index in any product.

Summary

  • Three categories: libraries, database extensions, dedicated vector databases.
  • Choose on scale, filtering, updates, hybrid needs, operations and latency, not on hype.
  • Start simple and move up when a measured limit appears.
  • Estimate memory early: vectors x dimensions x bytes, plus index overhead.
  • Keep source text and model versions so the index is always rebuildable.

Next: What Are Embeddings?