Introduction
A vector database is a specialized database designed specifically to store, index, and search embeddings — the dense numerical vectors covered extensively in the earlier Embeddings section — at scale, efficiently finding the most similar vectors to a given query rather than performing exact lookups the way traditional databases do. Where a conventional database excels at finding records that exactly match a specific value, a vector database excels at a fundamentally different kind of question: out of millions or billions of stored vectors, which ones are closest in meaning to this new one?
This module returns to and consolidates concepts already introduced earlier in this curriculum — the FAISS, ChromaDB, Pinecone, Weaviate, Milvus, and Qdrant topics covered specific vector database products, while this section now builds up the underlying concepts (storage, similarity search, ANN indexing) that make all of those products actually work.
Why Do Vector Databases Matter?
Vector databases help to:
- Store massive collections of embeddings efficiently, ready for fast retrieval
- Find the most semantically similar items to a query, not just exact matches
- Power retrieval-augmented generation (RAG) systems by locating relevant context for an LLM
- Scale similarity search to millions or billions of vectors while remaining fast
- Combine vector similarity with traditional metadata filtering for more precise results
- Serve as the essential infrastructure layer connecting embeddings to real-world applications
Why Traditional Databases Aren't Built for This
A traditional relational database, as covered in the earlier MySQL and PostgreSQL topics, is optimized around exact matches and structured queries — finding every row where a customer ID equals a specific value, for instance, is something these systems handle extremely efficiently through indexing techniques built for that exact purpose. But asking "which of these million stored vectors is most similar to this new vector" is an entirely different kind of question, one that traditional indexing structures aren't designed to answer efficiently, since similarity in high-dimensional space doesn't map cleanly onto the kind of exact-match or range-based lookups those systems are built around.
What a Vector Database Actually Stores
At its core, a vector database stores embeddings — the numerical vectors produced by an embedding model, as covered in the earlier Text to Vectors topic — alongside a reference back to whatever original content that vector represents, such as a document, an image, or a product description. Most vector databases also allow storing additional metadata alongside each vector, covered in more depth in an upcoming topic, enabling searches that combine similarity with structured filters, like "find similar products, but only within a specific price range."
The Core Workflow
A typical vector database interaction follows a consistent pattern: content is first converted into an embedding using a model like those covered in the earlier Embedding Models section, that embedding is stored (indexed) in the vector database along with any relevant metadata, and later, a new query is itself converted into an embedding and compared against everything stored, returning the closest matches based on a similarity metric like the cosine similarity or Euclidean distance covered earlier in this curriculum.
Why This Matters So Much for Retrieval-Augmented Generation
As introduced much earlier in this curriculum's Fine-Tuning Basics topic, retrieval-augmented generation (RAG) retrieves relevant external information and feeds it to an LLM as context, rather than relying purely on the model's own trained-in knowledge. A vector database is the essential piece of infrastructure that makes this retrieval step practical at scale — without an efficient way to search potentially millions of embedded documents for the handful most relevant to a given question, RAG simply wouldn't be feasible for any non-trivial knowledge base.
Key Capabilities Beyond Simple Storage
Modern vector databases typically provide several capabilities working together, each covered in more depth in the topics that follow this one: efficient storage of embeddings at scale, the ability to attach and filter on metadata alongside vectors, organizational structures like collections or namespaces for separating different types of data, and — critically — approximate nearest neighbor (ANN) search algorithms that make similarity search fast even across enormous collections, trading a small amount of accuracy for massive gains in speed.
Vector Databases vs Traditional Databases
| Aspect | Traditional Database | Vector Database |
|---|---|---|
| Core Query Type | Exact match or range-based lookup | Similarity-based nearest neighbor search |
| Underlying Data | Structured rows and columns | Dense numerical vectors (embeddings) |
| Typical Index Type | B-trees, hash indexes | Specialized ANN structures (covered in a later topic) |
| Example Question | "Find all orders placed after March 1st" | "Find the 5 most similar documents to this query" |
| Common Pairing | Application backends, transactional systems | LLM applications, semantic search, recommendation systems |
Key Properties of Vector Databases
- Vector databases are purpose-built to efficiently store and search embeddings, not structured, exact-match data.
- They typically store a reference to original content alongside each vector, and often additional metadata as well.
- Similarity search relies on metrics like cosine similarity or Euclidean distance, both covered earlier in this curriculum.
- Vector databases are the essential infrastructure enabling retrieval-augmented generation at scale.
- Modern vector databases combine efficient storage, metadata filtering, organizational structures, and fast ANN search together.
Where Are Vector Databases Used?
| Field | Application |
|---|---|
| Retrieval-Augmented Generation | Retrieving relevant context to feed into an LLM's prompt |
| Semantic Search | Powering search that understands meaning, not just keywords |
| Recommendation Systems | Finding similar products, content, or users based on embeddings |
| Duplicate and Anomaly Detection | Identifying near-duplicate content or unusual outlier data points |
| Image and Audio Search | Finding visually or acoustically similar media, not just exact matches |
Advantages
- Purpose-built for the specific, common need of similarity-based search over embeddings
- Scales to handle millions or billions of vectors while remaining fast, thanks to ANN indexing
- Combines vector similarity with metadata filtering for more precise, practical results
- Serves as essential, foundational infrastructure for RAG and semantic search applications
- A mature, well-established ecosystem of products already covered earlier in this curriculum
Limitations
- Introduces an additional piece of infrastructure to manage alongside traditional databases
- Requires embeddings to already be generated before anything useful can be stored or searched
- Choosing appropriate index settings and similarity metrics requires some understanding of the underlying tradeoffs
- Not a replacement for traditional databases, but rather a complementary, specialized tool
- Performance and cost characteristics vary significantly across different vector database products
Real-World Examples
| Application | Vector Database Use |
|---|---|
| RAG-Based Chatbots | Storing and retrieving embedded knowledge base documents |
| E-Commerce Search | Finding semantically similar products for a user's search query |
| Content Recommendation Platforms | Matching users to similar content based on embedded preferences |
| Fraud Detection Systems | Identifying transactions with embeddings similar to known fraudulent patterns |
| Reverse Image Search Tools | Finding visually similar images based on embedded visual features |
Best Practices
- Understand vector databases as a complement to, not a replacement for, traditional databases.
- Choose a similarity metric consistent with whatever the underlying embedding model was designed and evaluated with.
- Store relevant metadata alongside vectors when structured filtering will be needed alongside similarity search.
- Consider the specific tradeoffs of different vector database products, as covered in earlier dedicated topics.
- Plan for how embeddings will be generated and kept up to date as the underlying content changes over time.
Interview Tip
A common interview question is:
"Why can't you just use a traditional relational database to perform similarity search over embeddings?"
A strong answer is:
Traditional relational databases are optimized around exact matches and structured queries, using indexing structures like B-trees that work well for finding rows matching a specific value or falling within a specific range. Similarity search over embeddings is a fundamentally different problem — it requires finding which vectors, out of potentially millions, are closest to a query vector in high-dimensional space, which doesn't map cleanly onto the kind of indexing traditional databases use. Vector databases are purpose-built with specialized approximate nearest neighbor algorithms specifically designed to make this kind of similarity search fast and scalable, which is why they've become a necessary, complementary piece of infrastructure alongside traditional databases for embedding-based applications.
Explaining specifically why traditional indexing doesn't apply makes your answer stronger.
Conclusion
Vector databases provide the essential, purpose-built infrastructure for storing and efficiently searching embeddings, answering fundamentally different questions than traditional databases and enabling everything from semantic search to retrieval-augmented generation at scale. With this conceptual foundation established, the next topic dives into how embeddings are actually stored within these systems, building toward the metadata, organizational structures, and similarity search algorithms covered throughout the rest of this module.