What Is a Vector Database?

How AI searches by meaning, not keywords β€” and why every RAG system needs one.

How It Works

Vector Databases: 6 Core Concepts

From embeddings to similarity search β€” the building blocks.

πŸ› οΈ
1. Embeddings: Meaning as Numbers
Tap to flip
An embedding converts text (or images, audio) into a list of numbers β€” typically 768–1536 values. Similar meanings produce similar numbers. β€œCat” and β€œkitten” have close embeddings; β€œCat” and β€œCar” are far apart. Embedding models (like OpenAI’s text-embedding-3 or the open-source BGE) generate these vectors. [1]
πŸ“Š
2. Vectors: Coordinates in Space
Tap to flip
Each embedding is a vector β€” a point in high-dimensional space. A 768-dimensional vector lives in 768-dimensional space (impossible to visualise, but mathematically precise). Similar content clusters together in this space. The database stores millions of these vectors.
πŸ“Έ
3. Similarity Search
Tap to flip
When you search, your query is converted to a vector using the same embedding model. The database finds the nearest vectors using distance metrics like cosine similarity (angle between vectors) or Euclidean distance (direct distance). This is what captures meaning. [2]
⚑
4. ANN: Approximate Nearest Neighbour
Tap to flip
Searching millions of vectors exactly is slow. Vector databases use ANN algorithms (like HNSW β€” Hierarchical Navigable Small World) to find approximate matches in milliseconds. Think of it as a map with neighbourhoods β€” you search the right neighbourhood, not every house. [1]
πŸ€–
5. RAG + Vector DB
Tap to flip
Vector databases are the backbone of RAG. Documents are chunked, embedded, and stored. When a user asks a question, the system searches the vector DB for the most relevant chunks, then feeds them to the LLM as context. This is why vector DBs and LLMs grew together.
πŸ“
6. Vector DB vs SQL DB
Tap to flip
SQL databases search by exact match (β€œWHERE price = 10”). Vector databases search by similarity (β€œfind me documents like this one”). They serve different purposes. Many modern systems use both: SQL for structured data, vector DB for semantic search. [3]
Deep Dive

Key Concepts Explained

The mechanisms that make vector search possible.

πŸ“
High-Dimensional Space
Tap to flip
Think of a 2D map where nearby cities are close together. Now imagine 768 dimensions instead of 2. Each vector is a point, and similar-meaning vectors cluster together. We cannot visualise it, but the math works the same way as your 2D map.
πŸ’‘
Cosine Similarity
Tap to flip
The most common way to measure vector similarity. It measures the angle between two vectors, ignoring their length. Two vectors pointing in the same direction (small angle) are semantically similar. Range: -1 (opposite) to +1 (identical). 0.8+ means very similar.
πŸ“ˆ
HNSW Index (Hierarchical)
Tap to flip
The most popular ANN algorithm (2024–2026). Creates layers of connections β€” top layer has long-range links (fast search), bottom layer has detailed links (precision). Like navigating from a world map β†’ country map β†’ street map in milliseconds. [1]
πŸŒ€
Hybrid Search (Vector + Keyword)
Tap to flip
Many vector databases also support keyword + vector search combined. This handles edge cases where exact keyword matching matters (e.g. product codes, proper names). Results from both searches are merged and re-ranked. Best of both worlds.
πŸ”
Metadata Filtering
Tap to flip
Vector DBs can store metadata alongside vectors (date, author, category, access level). Search filters by metadata first, then finds nearest vectors within the filtered set. Essential for production: β€œFind similar documents from 2026 only.”
🌐
Popular Vector DBs (2026)
Tap to flip
Pinecone (fully managed, cloud-native). pgvector (Postgres extension β€” use your existing DB). Chroma (lightweight, good for dev). Weaviate (full-featured, open-source). Qdrant (Rust-based, fast). Each has different trade-offs in speed, cost, and features.
Quiz

Vector Database Knowledge Check

6 questions. TRUE or FALSE?

About how vector databases store data:

Vector databases store data as lists of numbers that represent meaning or features.

Comparing vector DBs with SQL:

A vector database can replace a traditional SQL database for most applications.

About how search works:

Vector databases use cosine similarity to measure how close two vectors are in terms of meaning.

About the search speed:

Vector databases search by comparing a query vector against every stored vector one by one.

About RAG systems:

Vector databases are the core storage layer in most RAG architectures.

About embeddings:

The words "king" and "queen" would have very different vector embeddings.

Use Cases

When Do You Need a Vector DB?

From simple search to enterprise RAG β€” slide to see the scale.

30
050100
Slide the dial
Key Takeaways

Vector Databases: What to Remember

Tap to check off each concept.

Vectors encode meaning as numbers
Embedding models convert text/images/audio into lists of numbers. Similar content produces similar numbers.
Search by similarity, not exact match
Vector DBs find things that are "like this" not "equal to this." This captures meaning and context.
ANN makes search fast
Approximate Nearest Neighbour algorithms (HNSW, IVF) find matches in milliseconds across millions of vectors.
Essential for RAG
Vector DBs are the memory layer behind most AI applications that need to retrieve and ground information.
Not a SQL replacement
Vector DBs complement SQL databases. Use both: SQL for structured data, vector DB for semantic search.
Hybrid search is best practice
Combining vector similarity with keyword matching and metadata filtering produces the most accurate results.
Choose the right DB for your scale
Chroma for prototypes, pgvector for Postgres users, Pinecone/Weaviate for production, Milvus for enterprise.