Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Techniques

Vector Databases

About 1346 characters Updated Nov 30, 2026 26 views AI wiki

Vector databases are databases specialized for storing and retrieving high-dimensional vectors, and they are the core infrastructure of a RAG system.

Why ordinary databases do not work

Traditional databases are good at exact matching: "find the record with id=123". But what RAG asks is "find the 10 passages closest in meaning to this sentence" - that is a semantic similarity computation, and traditional indexes are completely powerless here.

Core principle: approximate nearest neighbor (ANN)

Computing the distance between every vector and the query exactly is too slow (a million-scale dataset requires a million computations). Vector databases use approximate algorithms, trading a little accuracy for a speedup of tens of times. Mainstream algorithms:

  • HNSW: hierarchical navigable small world graph, fast queries, high accuracy, the most widely used
  • IVF: inverted file index, coarse clustering first and fine search second
  • PQ: product quantization, compresses vectors for storage and saves memory

Mainstream products

  • Milvus: open source, full-featured, supports billion-scale
  • Qdrant: written in Rust, good performance, lightweight deployment
  • Weaviate: built-in modules, supports hybrid retrieval
  • Chroma: lightweight, suited to prototyping
  • pgvector: a PostgreSQL extension, a good choice when you do not want a new component
  • Pinecone / Zilliz: cloud-hosted services

How to choose

For small data volumes (below a million) pgvector or Chroma is enough; for tens of millions and above consider Milvus or Qdrant; if you do not want to operate anything, use a cloud service.