Traditional databases match exact values or keywords. A vector database compares numerical embeddings, so a search for 'cheap flights' can find 'budget airfare'. It is a core building block of RAG systems, semantic search and recommendation engines, and usually stores the original text and metadata alongside each vector.

How it works

First, an embedding model converts each item, such as a paragraph, product description or image, into a vector: a list of numbers, typically hundreds to a few thousand long. Items with similar meanings end up close together in this high-dimensional space. The database stores these vectors with an ID, the original content and metadata such as date or author. At search time, the query is embedded with the same model, and the database looks for the nearest vectors using a similarity measure such as cosine similarity, dot product or Euclidean distance. Comparing the query with every stored vector would be too slow at scale, so vector databases use approximate nearest neighbour indexes. Popular methods include HNSW, which builds a layered graph of neighbours, and IVF, which groups vectors into clusters and only searches the most relevant ones. These trade a tiny amount of accuracy for very large speed gains across millions of items. Most systems also support metadata filters and hybrid search, which blends vector similarity with keyword matching. Options include dedicated databases such as Pinecone, Weaviate, Milvus, Qdrant and Chroma, and extensions such as pgvector for PostgreSQL.

Why it matters

A vector database is what lets an AI assistant answer from your own documents rather than only its training data. Businesses use one to build chatbots over help centres, policies or product catalogues, and creators can make their back catalogue of videos or articles searchable by topic. For small projects, a vector extension on an existing database is often enough; a dedicated service matters more at large scale.

Where you will see it

  • Powering RAG chatbots that answer from company documents.
  • Semantic search across articles, transcripts or support tickets.
  • Recommending similar products, videos or posts.
  • Finding duplicate or near-duplicate content and images.

Limits and common misconceptions

  • Results are only as good as the embedding model and how documents are split into chunks.
  • Similarity is not truth: the nearest result can be related yet still not answer the question.
  • Embeddings from different models are incompatible, so changing models means re-embedding everything.

How it differs from related terms

Frequently asked questions

Do I need a vector database for RAG?

Not always. For a small number of documents you can keep embeddings in memory or in a standard database with a vector extension such as pgvector. A dedicated vector database becomes more useful with millions of items, heavy traffic or complex filtering.

What is the difference between vector search and keyword search?

Keyword search matches exact words, so it misses synonyms and paraphrases. Vector search matches meaning, so it finds related content with different wording. Keyword search is better for exact names, codes and IDs, which is why many systems combine both.

What is cosine similarity?

Cosine similarity measures the angle between two vectors, ignoring their length. Vectors pointing in nearly the same direction score close to 1, meaning similar content. It is one of the most common ways vector databases decide which stored items best match a query.

Related terms

All AI terms