What is a vector database?
A vector database stores data as embeddings, lists of numbers that capture the meaning of text, images or other content, and finds the items closest in meaning to a query. AI applications use vector databases for semantic search, recommendations and retrieval-augmented generation (RAG).
For example, a hospital IT team loads 200,000 discharge summaries into a vector database so clinicians can ask an assistant about past cases. Each summary is split into chunks, embedded and stored with its original text as metadata. The index now holds patient names, dates of birth and diagnoses, readable by any app or user with access to the collection.
How a vector database works
- Embed. An embedding model converts each item, such as a paragraph, into a vector with hundreds or thousands of numbers.
- Store. The database keeps the vector, the original text and metadata such as source, date and owner.
- Index. Approximate nearest neighbor (ANN) indexes make similarity search fast across millions of vectors.
- Query. A question is embedded with the same model and compared to stored vectors by a similarity score.
- Filter and return. The closest matches come back, often narrowed by metadata filters.
Vector search is offered by dedicated vector databases and as a feature of many existing databases and search engines, such as PostgreSQL with the pgvector extension. The privacy questions are the same either way: what text is stored next to the vectors, who can query it and how records are deleted.
Vector database vs relational database
| Vector database | Relational database | |
|---|---|---|
| Finds data by | Similarity of meaning | Exact values and SQL conditions |
| Typical data | Embeddings plus text chunks | Rows and columns |
| Typical use | Semantic search, RAG, recommendations | Transactions, reporting, records |
Privacy risks in vector databases
- Raw text next to vectors. Most RAG setups store the original chunk so it can go into the prompt, which puts plain-text PII in the index.
- Embeddings are not masking. Embedding inversion research has recovered much of the original text from some embeddings, so treat vectors as sensitive too.
- Hard deletion. Meeting a right to be forgotten request means finding every chunk that mentions a person.
- Coarse access control. Permissions are often set per collection, not per user or record.
- Copies. Indexes get rebuilt and copied across dev, test and production.
These risks grow with scale. A single collection can hold millions of chunks from email, tickets, contracts and medical notes, and few teams review what each source contains before it is loaded.
How Protecto helps
Protecto tokenizes sensitive values before documents are chunked and embedded, so the vector database stores consistent tokens instead of raw PII or PHI. Search still works because the same value always gets the same token, and real values are revealed only to users whose role and context allow it. The guide on how to keep PII out of a vector database shows the steps, and Protecto Secure RAG applies them to RAG.
Stored chunk: <PERSON>tok_19bd</PERSON>, DOB <DOB>tok_4c0e</DOB>, admitted with chest pain, discharged after 2 days.
Frequently asked questions
Is data in a vector database encrypted?
Many vector databases encrypt data at rest, but encryption does not stop an app or user with query access from reading the stored text. Masking sensitive values before ingestion protects the content itself.
Can embeddings be reversed to recover the original text?
Partly, in some cases. Inversion techniques have reconstructed much of the source text from certain embeddings, so embeddings of sensitive text should be protected like the text.
Do you need a vector database for RAG?
No. RAG can use keyword search or a regular database. Vector databases are common because they match questions to documents by meaning rather than exact words.
Related terms
Retrieval-augmented generation (RAG) · Tokenization · Data minimization · Sensitive data · Data retention