A vector database stores embeddings, numerical representations of text, images or other data, and finds the items most similar in meaning to a query. It is the search engine behind most RAG systems and AI assistants that answer from your documents. Popular options include managed services such as Pinecone, open-source databases such as Weaviate and Qdrant, and pgvector, an extension that adds vector search to PostgreSQL. Many teams start with pgvector if they already use Postgres.
- ✓Vector databases search by meaning using embeddings
- ✓They power retrieval in RAG systems
- ✓pgvector adds vector search to an existing Postgres database
- ✓Pinecone is managed; Weaviate and Qdrant are open source with cloud options
- ✓Choose by scale, hosting needs, filtering and existing stack
What is a vector database?
Traditional search matches words. Ask for “cancel my subscription” and a keyword search may miss a passage titled “ending your annual plan”. Vector search matches meaning. An embedding model converts each piece of text into a vector, a long list of numbers, so that passages with similar meaning sit close together. A vector database stores those vectors and quickly finds the ones nearest to the vector of a query. That is the retrieval step in retrieval-augmented generation (RAG).
- Split into chunks
- Create embeddings
- Store with metadata
- Same embedding model
- One query vector
- Similarity search
- Filter by metadata
- Return top passages
What are the main options?
Other databases, including MongoDB, Elasticsearch and Redis, also support vector search, so check what your team already uses before adding a new system.
How do you choose one?
- Scale: how many chunks today, and in a year?
- Hosting: managed service, your cloud or on-premise?
- Filtering: do you need to filter by user, team, date or document type?
- Hybrid search: do you need keyword and vector search together?
- Cost: storage, queries and the team time to run it
- Data rules: where must the data live?
Do you need a separate vector database?
- One database for app data and vectors
- Familiar SQL and backups
- Good for most small and mid-sized projects
- Fewer systems to secure
- ✓Built for very large vector collections
- ✓Advanced indexing and scaling features
- ✓Managed options reduce operations work
- ✓Another system to integrate and pay for
What does a real setup look like?
A SaaS company wants its support assistant to answer from 2,000 help articles and product docs. It already runs PostgreSQL, so it adds the pgvector extension and a table holding each chunk’s text, embedding, article title, product area and last-updated date. A nightly job re-embeds changed articles. When a customer asks a question, the app embeds it, runs a similarity search filtered to the customer’s product, and passes the top five chunks to the language model. The whole setup lives in the existing database, uses existing backups and needs no new vendor. If volumes grow to tens of millions of chunks or latency becomes a problem, the team can move the vectors to a dedicated database later.
What does it cost?
Costs come from three places: creating embeddings, storing vectors and running queries. Embedding is usually cheap per document but adds up when you re-index often. Managed services charge for storage and usage; self-hosted options cost server time and maintenance. For most business knowledge bases, the vector store is a small part of the total cost compared with language-model calls, which our guide to cutting LLM API costs covers.
What about security and permissions?
- Store permission metadata with each chunk and filter every query by the user’s access
- Keep vectors of sensitive documents in the same region and controls as the originals
- Remember that embeddings can leak information, so protect them like the source text
- Delete vectors when the source document is deleted
What matters more than the database?
- The quality and freshness of the content you index
- How you split documents into chunks
- The embedding model you choose, and using the same one for queries
- Adding metadata such as title, date and permissions
- Testing retrieval with real questions before launch
Retrieval quality is covered in our RAG guide.
Start simple, measure retrieval quality on real questions and only add a specialised system when your scale or requirements clearly call for it.
Document which embedding model and chunk settings you used, because changing either later means re-indexing everything.
Plan regular re-indexing so search results stay in step with your latest documents.
Test a few embedding models on your own questions before committing; retrieval quality varies by language and domain.
How UIUX Studio helps
We design retrieval systems for AI assistants, from choosing a vector store to chunking, permissions and evaluation. Talk to our product engineering team.
