AI & integration

What is a vector database? How embeddings power AI search

Someone types "laptop overheating" into your support search and gets nothing, because every article on file calls it "notebook thermal throttling". The words missed each other. The meaning was identical. That gap, between what people type and what they mean, is the problem a vector database exists to close, and it is why almost every serious AI feature we build at Shipshape Data ends up leaning on one.

Traditional databases are very good at what they were built for. Names, transaction amounts, product IDs, exact matches, clean joins. Ask one to find content that means roughly the same thing as your question, though, and it has nothing to reach for. A vector database stores data as numbers that carry meaning, so it finds the closest ideas rather than the identical strings. That single shift is what makes modern AI search, recommendation engines and retrieval-augmented generation work at all.

This guide covers how vector databases work, how they differ from the relational databases you already run, where they fit in a RAG pipeline, and what to check before you pick one. We see the same thing with clients: an AI prototype dazzles in the demo, then falls over the moment it meets real volume and real users. More often than not, the missing piece is here.

Why vector databases matter for AI search

Keyword search treats your query as a string of characters. It looks for those characters, or close variations, and hands back whatever contains them. That is fine when you know the exact term. It falls apart the second the searcher and the author chose different words for the same thing, which is most of the time.

Keyword search keeps missing the point

Search "laptop overheating issues" in a keyword system and you will not see the document titled "notebook thermal problems" unless someone tagged it by hand. Your support team knows those phrases describe one issue. The index does not. The usual fix is to bolt on synonym lists, metadata and manual tags, then keep feeding that machine as language drifts and new products land. It is slow, thankless, and never quite catches up.

The pain gets worse across unstructured content like tickets, contracts and product descriptions. You can build a full-text index over all of it, but that index still matches tokens. It has no idea that "cannot connect to the network" and "wifi keeps dropping" are the same complaint. What AI applications need is retrieval based on what content means, not which letters it shares with the query.

Semantic search changes what is possible

A vector database stores your content as numbers that capture meaning. When a question comes in, it turns that question into the same kind of number and finds content sitting nearby in that space, whatever words it used. That is semantic search. Take a support ticket that says "my device won't charge anymore". A semantic system pulls back your documentation on power faults, battery health and charging-port failures, even when not one of those pages contains the phrase "won't charge". The agent gets relevant answers in seconds instead of scrolling through a hundred maybe-related articles. The same principle drives recommendations and document discovery, from surfacing patents that describe a similar idea in different words to spotting feedback themes a keyword pass would miss.

Speed and scale separate the pilot from production

This is where most projects meet reality. A prototype that hums over a few thousand documents can buckle under a few million records and a few hundred concurrent users. Vector databases are built for that jump, using indexing designed for similarity search so they stay fast as the data grows rather than grinding to a crawl.

Your users expect answers in milliseconds. When someone asks your chatbot a question, a two-second wait already feels broken. Vector databases hit that speed with techniques like approximate nearest neighbour search, which gives up a sliver of theoretical precision for an enormous jump in real-world performance. They also hold up under concurrency. Ten developers poking at it during a build is nothing like a thousand staff querying it live, and that gap is usually the line between an experiment and a system that earns its place.

Vectors and embeddings, explained plainly

Two words do all the heavy lifting here, and both are simpler than they sound. A vector is a list of numbers. An embedding is a particular kind of vector that a machine learning model produces to capture the meaning of a piece of text, an image or some other input. That is the whole vocabulary.

What an embedding actually represents

When you type a sentence, the AI system does not work with your words as words. It converts them into an embedding, a list of hundreds or sometimes thousands of numbers that encodes what the words mean and how they relate to other concepts. The model learned those numbers by training on huge volumes of text, picking up which words and ideas tend to travel together, so the result reflects real relationships rather than random assignment.

The usual mental image is coordinates in a space of meaning. "King" and "queen" land near each other because they share so much. "King" and "bicycle" sit far apart. Embeddings also carry context, which is the clever bit: "bank" beside a river points to a different spot than "bank" holding your money.

Because embeddings encode meaning rather than spelling, "customer satisfaction" and "client happiness" land close together despite sharing no words at all.

That property is what everything else depends on. Two phrases can look nothing alike and still produce near-identical embeddings, which is what lets a vector database find the right answer when the question and the document were written by different people using different words.

How the comparison works

The underlying rule is almost embarrassingly simple: similar meanings produce similar numbers. When a query arrives, the system turns it into an embedding and measures the distance between that query vector and the stored ones. Short distance means close in meaning, long distance means unrelated. Do that fast enough and you get the most relevant results back regardless of word choice.

The distance itself is worked out with methods like cosine similarity or Euclidean distance, but you do not need the maths to hold the picture. Imagine points scattered on a graph where similar ideas cluster; finding relevant content becomes a matter of spotting which stored points sit nearest the query point. Vector databases speed this up by carving the space into regions and checking only the promising ones, which is what makes real-time search possible once you are past toy volumes.

How a vector database works under the hood

Behind the tidy idea of "find similar things fast" sits some real engineering. Production systems lean on three parts: an index that organises vectors so retrieval stays quick, a storage layer that copes with large datasets without eating all your memory, and query processing that returns results in milliseconds. Each answers a headache that shows up when you are comparing millions of high-dimensional vectors thousands of times a second.

Indexing that keeps similarity search fast

The speed comes from indexing structures that slash the number of comparisons a search has to make. Instead of measuring your query against every stored vector, these algorithms either split the space into regions or build graphs that let the search hop straight towards the likely candidates. That is the difference between a query that takes seconds and one that finishes before you notice it started.

Hierarchical Navigable Small World graphs, usually shortened to HNSW, are one common approach. The database builds a layered graph where each vector links to its nearest neighbours. A search starts at the top layer, with long-range connections, and works down through shorter, more precise links until it lands on the closest matches, touching only a tiny fraction of the stored vectors on the way. The trade underneath governs the whole field: for nearly every application, 95% accuracy in ten milliseconds beats 100% accuracy in ten seconds, and these indexes are built around that bargain.

Inverted File indexes, or IVF, take a different route. They group similar vectors into clusters and keep an index pointing at each one. A query works out which clusters are worth looking at, then searches only inside those. Your database might hold millions of vectors while a single query examines only thousands. Clustering like this shines when the data has natural groupings, or when you can live with slightly lower recall in exchange for a real jump in speed.

Storage and query mechanics

A vector database does not simply dump raw embedding values on disk and hope. It keeps compressed representations and metadata that make filtering and retrieval efficient. Quantisation trims the precision of stored vectors, trading small accuracy losses for large cuts in memory use and disk reads. Product quantisation, for instance, chops each vector into subvectors and swaps them for entries from a learned codebook, shrinking storage tenfold or more while keeping search quality where production needs it.

Query processing runs in stages. The system first turns the incoming query into an embedding using the same model that produced the stored vectors. It then applies the index to gather candidates, scores them with precise distance calculations, and filters against any metadata rules you have set. The expensive operations only ever run on the small set of vectors that survive the first screen, not the whole dataset.

Vector database versus relational database

The clearest way to understand a vector database is to hold it up against the relational databases you already run. They solve genuinely different problems, and seeing the split helps you pick the right tool for each job. Your PostgreSQL or MySQL instances are excellent at structured data and exact queries. They were never meant for similarity search, and asking them to do it is where things go wrong.

What relational databases were built for

Relational databases sort your information into tables with defined schemas, a row per record and a column per attribute. They are strong on transactions, data integrity and queries that filter or join on exact matches. Find every customer who bought a product last quarter, total revenue by region: all of that runs fast and accurately through B-tree indexes and well-tuned query plans.

Those indexes earn their keep by holding sorted references to your data, so a lookup on email addresses runs in logarithmic time instead of scanning every row. Brilliant for exact matches and range queries. But the whole design assumes you are hunting for specific values or ranges, not for conceptual closeness.

A relational database answers "which records match this criterion?" A vector database answers "which records mean roughly the same thing as this?"

Where traditional indexes fall short for AI

The wall appears the moment an AI feature needs semantically similar content. A relational database cannot efficiently measure the distance between high-dimensional vectors in its columns. You can store embeddings as arrays in PostgreSQL and write a query that computes cosine similarity, and it will work, technically, by scanning every row and running expensive maths on each one. What a vector database does in milliseconds takes seconds or minutes here, which rules out production use.

Full-text search does better than a plain B-tree, but it still leans on token matching rather than real understanding. A PostgreSQL full-text index will find documents containing variations of your search terms, yet it will not retrieve conceptually similar content written in a different vocabulary. So you are back to hand-curating synonyms, an approach that scales badly and keeps missing the subtle relationships embeddings pick up for free.

Worth being clear on one thing: a vector database does not replace your relational one. The two sit side by side. Transactional data, user accounts and business logic belong in PostgreSQL or MySQL. Embeddings, semantic search and AI-driven retrieval belong in the vector store. Most production AI systems run both. When we design an architecture for a client, that division of labour is one of the first lines we draw.

How a vector database powers RAG

Retrieval-augmented generation, or RAG, has become the standard way to build AI that answers questions from an organisation's own knowledge. It pairs a large language model with a retrieval step that fetches relevant information before the model writes anything, and the vector database is the engine of that step. It is what turns a pile of static documents into something the model can query live.

The retrieval workflow, step by step

A RAG system starts by ingesting documents and breaking them into chunks, usually 200 to 1,000 tokens depending on the content. Each chunk goes through an encoder model that turns it into an embedding, and those embeddings land in the vector database alongside metadata: source document, date, author, whatever business tags matter. This happens once per document and produces a searchable knowledge base the AI can query repeatedly.

When a user asks a question, the system converts it into an embedding using the same encoder that processed the documents. This part is not optional: embeddings from different models live in different spaces and cannot be meaningfully compared, so mixing encoders quietly poisons your results. The vector database then runs a similarity search and returns the chunks whose embeddings sit closest to the query. Those chunks become the context the language model uses to write a grounded, accurate answer.

RAG works because it separates what the model knows, general language, from what it can reach, your specific and current information. That separation is what keeps it from making things up: the answer is grounded in retrieved text rather than the model's memory.

A few parameters shape how well retrieval performs. The number of chunks you pull back, often three to ten, balances useful context against token limits and cost. Metadata filters restrict a search to certain document types, date ranges or permission levels, so the model only ever sees what a given user is allowed to. Reranking adds a second-stage model over the first results, reordering them by genuine relevance rather than raw vector distance.

Why the vector database is what makes RAG scale

Production RAG serves thousands of people at once, each question firing off several similarity searches. The vector database soaks up that load through the indexing covered above, holding sub-second responses even while searching millions of chunks, where a relational database would fold long before performance felt acceptable. It also lets you update the knowledge base a piece at a time: when a document arrives or changes, you embed only the affected content rather than reprocessing everything. That keeps a RAG system current, which matters most in places like support, where the knowledge base moves daily and stale answers erode trust fast.

What to check before you choose one

Picking a vector database is less about the logo and more about matching the tool to your data volume, query patterns and operational limits. The choice shapes launch-day performance, running costs and maintenance load. The market runs from fully managed cloud services to self-hosted options, each trading control against complexity and cost differently.

Selection criteria that follow your workload

The database has to handle the dimensions of your embeddings, usually between 384 and 1,536 numbers per vector depending on the encoder. Some options do better with lower-dimensional vectors, others are tuned for higher ones, and matching that up front spares you the performance sag that shows up when a system is pushed outside its designed range.

Query patterns steer the indexing choice. An application that needs exact nearest neighbour results wants a different setup from one that will happily take approximate matches for speed. Choosing between HNSW, IVF or something else comes down to whether recall accuracy or latency matters more, and whether your workload is write-heavy or read-heavy. Match the database to how your workload actually behaves rather than to whatever technology is loudest this quarter, because the buzz rarely maps onto your read/write mix or your latency budget.

Filtering decides how well you can fold business logic into semantic search. RAG applications routinely need to bound a search by date, permission or document type. A database that filters on metadata efficiently, alongside the vector similarity, supports richer queries without forcing you to pull everything back and filter it in application code, which only adds latency and fragility.

The operational side, which decides real cost

Running a vector database in production means backups, monitoring and scaling. The team needs a clear view of query performance, index health and resource use to keep response times steady as the data grows. Managed cloud services absorb much of that for you. Self-hosted setups hand back more control over cost and data sovereignty, which counts for a great deal in organisations with strict compliance obligations.

How well a database fits your existing infrastructure shapes total cost of ownership well beyond the licence fee. One that slots cleanly into your cloud platform, observability stack and deployment pipelines saves real engineering effort at launch and every day after. Those unglamorous details, updates, schema changes, capacity growth, decide whether the theory turns into a system that actually runs.

Best for a first vector database: a managed service, if your team is small or new to this. It hides the indexing, scaling and backup work so you can focus on the AI feature. Watch for: encoder lock-in and dimension mismatch. Decide your embedding model early, keep query-time and index-time encoders identical, and confirm the database is happy at your vector dimension before you commit, not after you have loaded a few million records.

Where this leaves you

A vector database earns its place by solving the problems relational databases were never built for: semantic search, similarity matching and retrieval by meaning at scale. Get that layer right and your AI features move past the demo into something people rely on. Get it wrong, or skip it, and the project stalls in the gap between a promising prototype and a system that holds up under real load. For RAG, recommendations and anything that has to find relevant information quickly, this is core infrastructure. Most teams underrate that foundational work until an AI initiative grinds to a halt against it, and by then the fix costs more than it needed to.

Helping organisations build the data foundation underneath AI is what we do at Shipshape Data. If you are weighing up vector database options, or trying to move an AI project out of the pilot stage and into production, talk to us and start with a clear read on what your foundation actually needs.

Start at your core.

Tell us where your data is today and what you want AI to do. We will come back with a straight answer on what your foundation needs and where the quickest real win is.

Talk to us