Building with AI

What is a vector database?

In short

A vector database is a database built to store embeddings and quickly find the items whose meaning is closest to a question.

A normal database finds exact matches, such as a customer number. A vector database finds similar meaning, by comparing the number lists that embeddings produce. It is the search engine behind most RAG solutions.

Mini course

3 short lessons, about 2 minutes in total

  1. Search by closeness
  2. Options
  3. Practical advice

Lesson 1

Search by closeness

A normal database finds rows that match exactly: customer number 1042, orders from March. A vector database stores embeddings, long lists of numbers that represent meaning, and finds the ones closest to a query. That makes it the natural home for semantic search and for the retrieval step in RAG.

Documents
Vector database
Documents become embeddings and are stored in a vector database. A question is matched by meaning, and the closest passages go to the AI

Tap a box to open that concept

It answers 'what is most similar to this?' rather than 'what equals this?'.

Lesson 2

Options

Dedicated vector databases include Pinecone, Weaviate, Qdrant and Milvus. Many regular databases now support vectors too, such as PostgreSQL with pgvector, and cloud platforms offer built-in vector search. For small and mid-size collections, adding vectors to a database you already run is often simplest.

Alongside the vectors, store the original text, title, date, source and access rights.

Lesson 3

Practical advice

Pick one embedding model and stick with it, since vectors from different models cannot be mixed. Combine vector search with keyword search for names, codes and exact terms. Filter by metadata, such as language, date or department, before ranking. Rebuild or update entries when documents change.

  1. Customers find youHow customers and AI tools find the companySEOGEOGoogle AI Overviews
  2. AI in daily workTools staff and customers useChatbotAI copilotVoice AI
  3. Building blocksHow AI connects to data and systemsVector databaseRAG (retrieval-augmented generation)AI agentMCP (Model Context Protocol)
  4. AI modelsThe models that understand and createLarge language model (LLM)Generative AIMachine learning
  5. DataCompany data, gathered and cleanedData warehouseETLData quality
  6. InfrastructureCloud, networks and systems underneathCloud computingDatabaseAPI key
Trust and rulesSecurity, law and control in every layerGDPR and AIEU AI ActAI guardrails
Where Vector database sits in a company's AI setup

Measure search quality on real questions; it decides how good RAG answers can be.

An everyday example

Thousands of support articles are stored as embeddings; a customer question is turned into an embedding and the five closest articles come back in milliseconds.

How companies use it

Companies use vector databases for search across documents, product recommendations and finding similar past cases.

Frequently asked questions

Do we need a separate vector database?

A separate vector database is not always needed. Many regular databases, such as PostgreSQL with pgvector, can store vectors too.

Is our data safe in a vector database?

Embeddings can reveal content, so treat them with the same care as the original data.

How big does it need to be?

Small collections fit easily; size and cost grow with millions of documents.

In depth: Vector database

The full picture, about 4 minutes of reading

A database that finds similar meaning

A vector database is a database built to store embeddings and quickly find the ones closest to a question. An embedding is a long list of numbers that an AI model produces to represent the meaning of a piece of text, an image or another item. Items with similar meaning get similar lists of numbers.

A normal database answers "what equals this?": customer number 1042, all orders from March. A vector database answers "what is most similar to this?": the support articles closest in meaning to a customer's question, the products most like the one being viewed, the past cases that resemble a new one.

Why it is needed

Semantic search, searching by meaning rather than exact words, depends on comparing a question's embedding with the embeddings of every stored item and finding the nearest. With a few hundred items, a computer can simply compare them all. With hundreds of thousands or millions, comparing everything for every question becomes far too slow.

Vector databases solve that problem. They organize embeddings so that the closest matches can be found in a fraction of a second without checking every item. That makes them the natural storage for the search step in RAG, retrieval-augmented generation, where an AI assistant first finds relevant passages in company documents and then answers from them.

How it works, step by step

First, documents are prepared. Long texts are split into chunks of a few paragraphs, because a chunk with one clear topic gives a sharper embedding than a whole manual. Each chunk is run through an embedding model, and the resulting numbers are stored together with the original text and useful details called metadata: title, date, source, language, department and who may see it.

Second, the database builds an index, a structure that groups nearby embeddings so that search can jump straight to the right neighborhood. These methods are called approximate nearest neighbor search: they trade a tiny chance of missing the very best match for a huge gain in speed.

Third, when a question comes in, it is turned into an embedding with the same model, and the database returns the closest chunks. Filters on the metadata, such as "only Swedish documents" or "only documents this user may see", narrow the results before or during the search.

Choosing one

There are dedicated vector databases, such as Pinecone, Weaviate, Qdrant and Milvus, built for large collections and heavy use. Many regular databases also support vectors now, for example PostgreSQL with the pgvector extension, and the major cloud platforms offer built-in vector search. Some AI tools include a vector store so you never see it.

For small and medium collections, adding vectors to a database you already run is often the simplest choice, because the text, the metadata and the access rules stay in one place. A dedicated vector database makes more sense for very large collections, high search volumes or advanced features. Check whether it supports hybrid search, which combines vector search with classic keyword search, since that finds exact terms such as product codes and names that meaning-based search can miss.

Where it goes wrong

The most common mistake is mixing embedding models. Embeddings from different models live on different "maps" and cannot be compared, so if you switch model, every item must be embedded again. Another is forgetting updates: when a document changes or is deleted, its old chunks must be replaced or removed, or the assistant keeps answering from outdated text.

Access is a third risk. A vector database that ignores permissions can hand confidential passages to anyone who asks a well-phrased question. And embeddings are not anonymous: methods exist to reconstruct parts of the original text from them, so they deserve the same protection as the documents they came from. Finally, search quality must be measured with real questions, since it sets the ceiling for how good any AI answer built on it can be.

What it means for a small business

For a small business, a vector database is usually a part inside a larger solution rather than something to buy on its own. If you use an AI assistant that answers from your documents, there is very likely a vector store behind it. The questions worth asking the supplier are where it is hosted, how it handles access rights, how quickly it picks up document changes and how search quality is tested.

If you build something yourself, start with the database you already have, if it supports vectors. Store each chunk with its source, date and permissions, pick one embedding model and stick with it, and test with real questions from your own customers or staff.

Sources: pgvector (open source vector search for PostgreSQL)

Curious what this could mean for your company? Book a call.

Book a call