Vezi pagina în română

IT Glossary

What is a vector database and how does it search?

A vector database stores embeddings, the numerical fingerprints of what a piece of content means, and finds the items closest in meaning to a query, even when they share no words with it.

7
sections
6
questions answered

A vector database is a system that stores embeddings, the lists of numbers through which an AI model represents the meaning of a text, an image or a product, and quickly returns the items closest in meaning to a question: search for „ending a contract” and you get the clause about „termination”. It is not necessarily a new product to install: the open-source pgvector extension adds vector search to PostgreSQL (version 13 and later). By default it does exact search, and with an HNSW or IVFFlat index it does approximate search, which is faster at the cost of a small loss of accuracy. Dedicated products (Qdrant, Milvus, Weaviate, Pinecone) do the same at larger scale or as a managed service.

For a company, the vector database is the retrieval infrastructure behind a chatbot over your own documents, knowledge-base search and product recommendations. The quality of an AI answer depends on the fragments the vector database brings back: if it hands over the wrong ones, the model answers wrongly or makes things up, which is called hallucination.

Why it matters for your business

Retrieval by meaning, not by words

It finds synonyms and paraphrases that word search misses. Approximate indexes (HNSW) avoid comparing the query with every stored vector.

The engine behind chatbots on your own data

Retrieval-augmented systems depend on it: the vector store hands the AI exactly the fragments relevant to each customer or employee question.

Knowledge that stays current

New documents are indexed as they appear, so AI answers reflect the latest version of procedures and price lists without retraining. Delete a document and you delete its vectors too.

How a vector database searches

The process has five steps. Each document fragment is turned into a vector by an embedding model. The vector is saved with an ID, the fragment text and metadata: source, date, department, who has access. An index is built. The question is turned into a vector with the same model, then the database returns the k nearest vectors, measuring the distance between them (cosine, Euclidean L2 or inner product; pgvector offers all three, plus L1, Hamming and Jaccard).

Exact search compares the question with every stored vector. Approximate nearest neighbour (ANN) indexes trade a little accuracy for speed. HNSW is a layered graph, published by Yu. A. Malkov and D. A. Yashunin in 2016 (arXiv:1603.09320); IVFFlat splits the vectors into lists. According to the pgvector documentation, HNSW has better query performance but builds more slowly and uses more memory than IVFFlat, and an IVFFlat index is created after the table contains data.

Vector, relational and keyword search compared

A relational database looks for exact values: a company tax ID, an invoice number, an amount, a date, and links tables with JOINs. Full-text search finds documents that contain the requested words. A vector database finds close meaning even without shared words, but it is weak on exact codes: for an invoice number, an exact query remains the right choice.

Good systems combine keyword search with vector search, called hybrid search. The pgvector documentation recommends using it together with Postgres full-text search, and Qdrant and Weaviate offer it directly. The limits of embeddings are covered on the embedding page.

Want an estimate for your project?

Message us on WhatsApp. We reply the same working day, and the first 30-minute call is free.

Book a free call

Examples: extension, open source or managed service

Extension in your existing database: pgvector for PostgreSQL, open source, with HNSW and IVFFlat indexes and the L2, inner product, cosine, L1, Hamming and Jaccard distances.

Dedicated open source, hosted by you or in the cloud: Qdrant (written in Rust, Apache 2.0 licence, also available as Qdrant Cloud); Milvus (Apache 2.0 licence, developed by Zilliz, as Milvus Lite, Standalone in one Docker image and Distributed on Kubernetes, with the managed variant Zilliz Cloud); Weaviate (open source, with Weaviate Cloud, Docker and Kubernetes).

Managed service: Pinecone, with serverless indexes run by the provider; its documentation also mentions a Bring Your Own Cloud option. Checked on 18 November 2026 in the vendors' documentation; the list is not a ranking.

When you need one and when PostgreSQL is enough

One document, or a few that fit in the model's context, can usually be sent whole without a vector database. A large collection of documents needs retrieval. If the company already runs PostgreSQL, pgvector is the first step: the same backups, the same access rights, and business data and vectors in one database.

There is a concrete limit. In pgvector, an index on the vector type accepts at most 2,000 dimensions (4,000 on halfvec), although the column stores up to 16,000. Models with 3,072 dimensions (OpenAI text-embedding-3-large, Gemini Embedding in its default configuration) need either halfvec or a shortened vector through the model's dimensions parameter.

A dedicated database is justified when volume, required speed or filtering go beyond what the existing database does, and that is measured on the company's own data, not guessed.

Personal data and access rights

In our reading, vectors computed from texts containing personal data (contracts, emails, CVs) are treated like those texts, so they fall under the GDPR (definition of personal data, Art. 4(1)). Three things matter in practice.

First, deleting a document, including on an erasure request (GDPR Art. 17), deletes its vectors too. Second, each vector carries in its metadata who may see it, and the filter is applied at query time. Note that in pgvector, with an approximate index, filtering is applied after the index is scanned and can return fewer results; since version 0.8.0 iterative scans keep going until enough are found. Qdrant applies filters during the search. Third, hosting stays controlled: self-hosted or an EU region at the cloud provider.

Frequently asked questions

Do I need a separate vector database, or will our existing one do?

Often the existing one will do: if the company runs PostgreSQL, the pgvector extension adds vector search to the same database. Qdrant, Milvus, Weaviate or Pinecone are chosen when a test on real data shows that volume, speed or filtering need more.

What happens to confidential data stored as vectors?

Vectors are derived from document content, so they are treated as sensitive data: controlled hosting, whether self-hosted or in an EU cloud region for GDPR purposes, encryption, and per-user filtering at query time so each person retrieves only documents they may see. Deleting a document deletes its vectors.

Does a vector database replace the company's normal database?

No, it complements it. Transactional data — invoices, orders, stock — stays in the relational database, while the vector store deals exclusively with meaning-based search across unstructured content. Modern architectures run both, each doing what it is good at.

What are the best-known vector databases?

Among the most used are pgvector (a PostgreSQL extension), Qdrant, Milvus and Weaviate (open source) and Pinecone (a managed service). In addition, some search engines and general-purpose databases have added vector fields. The list is not a ranking.

Is a vector database the same thing as RAG?

No: RAG is the method by which a chatbot first looks up the relevant fragments and only then writes the answer, while the vector database is where that lookup happens. A RAG system can also use keyword search, on its own or together with vector search.

What does approximate search (ANN) mean in a vector database?

It means the database does not compare the query with every vector but walks an index, usually HNSW. It almost always returns the same neighbours as an exact search, only much faster; occasionally a few results may be missing. The difference is checked on the company's own data.