Vector database

A vector database stores numerical embeddings of text/images/audio and finds similar items by distance, powering semantic search and RAG.

A vector database is built around one operation: given a query vector, find the K most similar vectors in your collection. That sounds niche until you realize it's the substrate for almost every "AI-powered search" product on the market.

The flow:

  1. You convert each document (or image, or audio clip) into an embedding — a list of ~1500 numbers that captures its meaning.
  2. You store those embeddings in the vector DB along with metadata (source URL, tags, timestamp).
  3. At query time, you embed the user's question the same way, then ask the DB for nearest-neighbor vectors using cosine similarity or dot product.
  4. You hand the retrieved documents to an LLM to generate the answer.

The leaders are Pinecone (hosted, easiest), Weaviate (hosted + self-host), Qdrant and Chroma (open-source), and pgvector (an extension that turns Postgres into a vector DB — increasingly the default for small/mid teams who don't want another service).

Important practical truths:

  • Pure vector search is rarely enough. Production systems blend vector search with keyword (BM25) filtering and a re-ranker. This is called "hybrid search."
  • Embedding model choice matters a lot. A bad embedding model wastes the rest of the pipeline.
  • You probably don't need a dedicated vector DB. For collections under a few million vectors, pgvector on existing Postgres outperforms most managed services on cost and ops simplicity.

FAQ

Do I need a vector database to build a chatbot?

Only if it needs to answer from documents it hasn't been trained on. A pure conversational chatbot doesn't need one. A 'chat with your PDF' product does.

Pinecone vs pgvector — which should I pick?

pgvector if you already have Postgres and have <5M vectors — you save a service. Pinecone if you need horizontal scale to 100M+ vectors, low-latency at the 99th percentile, or don't want to manage infra at all.

Related terms

Want to actually build with this?

Our Stack Builder picks the best AI tools for your specific project in under 60 seconds.

Build my stack →