vector database for rag

How to Choose a Vector Database for RAG

Table of Contents

Short answer. Choose a vector database for RAG by three numbers, then test one thing. First, count vectors: documents times chunks per document. Splunk’s architecture guide, read December 2, 2026, says flat (exact) search suits under 100,000 vectors. Second, check your filters. In pgvector, a filter on an approximate index runs after the scan, so a filter that matches 10% of rows leaves about 4 matches from the default candidate list of 40. Third, match the operations load to the team you have. Then measure recall on about 100 of your own questions, with your real filters, before you pick a database.

Written by the AgileFever editorial team. Facts checked on December 2, 2026 against the official pages of the organizations named in this post. AgileFever sells training for some of the topics covered here, and we say so wherever it applies. Numbers from third-party guides carry their source and date. Product limits come from each vendor’s own documentation.

A vector database stores embeddings, the lists of numbers that represent each chunk of your documents, and returns the chunks closest to a question. In a RAG pipeline it is the retrieval step. If it returns the wrong chunks, the model answers from the wrong text, however capable the model is. Choosing a vector database for RAG is therefore a retrieval decision, not a logo decision.

This guide turns the choice into four checks: vector count, metadata filters, keyword plus vector search, and the operations work your team can carry. It names products only where their official documentation states a technical fact. It does not rank them or compare prices. If you have not built a pipeline yet, start with the RAG pipeline tutorial for engineers, which covers the five stages in code. This post assumes you know them.

What the vector database does in a RAG query

Every RAG system runs the same five stages. The vector database owns stages 3 to 5, so those are the stages that decide what the model sees.

Where the vector database sits in a RAG query
1
Chunk the documents
Split each document into passages. Chunk size sets how much text the model receives per hit.
2
Embed each chunk
An embedding model turns each chunk into a vector. The model’s output size sets the dimensions you store.
3
Store vectors with metadata
Save each vector with fields such as customer, product version, date or access group. These fields become your filters.
4
Search for the nearest vectors
For each question, the index returns the closest chunks. You choose how many (the top k).
5
Filter, fuse and return
Apply the metadata filters, optionally merge keyword scores, then pass the chunks to the model as context.

The five stages are the standard RAG flow. This graphic is a diagram, not measured data.

Vector database for RAG: collect four numbers first

Collect these numbers before you read any product page: vector count, dimensions, the filters your users send, and how often documents change. Vector count is documents times chunks per document. Dimensions come from your embedding model, not from the database.

Splunk’s guide uses a worked example of 100,000 documents with 5 chunks each: 500,000 vectors at 1,536 dimensions. Stored as 32-bit floats, which use 4 bytes per number, the raw vectors take 500,000 times 1,536 times 4 bytes, or 3.07 GB. Splunk’s ranges put the total at 3.6 to 4.5 GB with an IVF index and 9 to 12 GB with HNSW. Those overhead ranges are Splunk’s estimates. Measure your own footprint before you buy memory.

Memory for 500,000 vectors at 1,536 dimensions

Raw vectors and index totals in GB. Bars scale to the upper end of each range.

Raw 32-bit float vectors3.07 GB
IVF index total (Splunk range)3.6 to 4.5 GB
HNSW index total (Splunk range)9 to 12 GB

Source: Splunk, How To Choose a Vector Database Architecture, published August 15, 2026, read December 2, 2026. The 3.07 GB raw figure is our arithmetic on the same example.

Index types and what each one trades

An index decides how the database finds neighbors. A flat search compares the query with every vector. It gives 100 percent recall, and its time grows with the vector count. Approximate indexes trade a little recall for speed and lower memory. Splunk gives these typical ranges.

Index Recall (Splunk range) Memory vs raw vectors Where it fits
Flat (exact) 100% 1x (baseline) Under 100,000 vectors, per Splunk. Splunk says 100,000 vectors take roughly ten times longer to search than 10,000
HNSW 95 to 99% 2 to 3x Large sets where recall matters and RAM is available
IVF 85 to 95% 0.2 to 0.5x Memory is tight and some recall loss is acceptable
DiskANN 90 to 95% 0.02x plus SSD Vectors outgrow RAM

Ranges from Splunk, read December 2, 2026. Treat them as starting points and measure recall on your own data.

Measure before you commit. Take 100 real questions, each with the chunk that should come back. Run a flat search as the baseline, then run each candidate index. Count how many correct chunks appear in the top 10 for each. A gap that appears only on filtered queries is the signal to act on.

Filtering: the rule most likely to change the answer

Most production RAG queries carry a filter: one customer’s documents, a product version, a date range or an access group. How the index applies that filter decides whether you get enough results to answer, and it often decides the shortlist for a vector database for RAG.

  • pgvector applies a filter after an approximate index is scanned. Its documentation gives the example: with HNSW and the default candidate list of 40, a filter that matches 10% of rows leaves about 4 matches on average. Iterative index scans, added in version 0.8.0, keep scanning until enough rows are found or a limit is reached.
  • Qdrant builds filter-aware HNSW edges only from payload indexes created before ingestion, according to its indexing documentation. Payload index types include keyword, integer, float, bool, geo, datetime, text and uuid.
  • Pinecone narrows the candidate pool before ranking, according to its hybrid search documentation.
  • Weaviate uses an inverted index that enables BM25 queries and speeds up filtering, according to its indexing documentation.

Test a filtered query on your data with the same filter your users will send, then count the results returned. If you need 10 correct chunks and the search returns 4, the answer will miss facts without any error message.

Hybrid search: keyword and vector together

Vectors match meaning. Keyword search matches exact tokens such as a clause number, an error code or a product SKU. Hybrid search combines both, and each product fuses the two result sets differently.

  • Weaviate fuses vector and BM25F results. Alpha 1 means pure vector search and alpha 0 means pure keyword search. Relative Score Fusion has been the default since version 1.24.
  • Qdrant runs each query as a prefetch and merges the results with reciprocal rank fusion (rrf) or distribution-based score fusion (dbsf). Its BM25 search needs a full-text index on the payload field.
  • Pinecone recommends one index for new workloads, with a string field for full-text search and a dense vector field. Separate searches are merged on the client with reciprocal rank fusion.
  • pgvector keeps vectors in Postgres. Its documentation says to use it together with Postgres full-text search, merged with reciprocal rank fusion or a cross-encoder.

If your questions contain exact codes, run a query with one of those codes on each candidate. Check whether a vector-only setup returns the right chunk.

Decision table: what each product’s documentation states

The table lists technical facts from each product’s own documentation, read December 2, 2026. It is not a ranking. Check the version your team would install, because limits change between releases.

Product Index types (official docs) Filters and hybrid search (official docs)
pgvector HNSW and IVFFlat. Indexed vector columns hold up to 2,000 dimensions; halfvec up to 4,000 Filters run after the approximate scan; iterative scans from 0.8.0. Hybrid by combining with Postgres full-text search
Qdrant HNSW. Payload index types: keyword, integer, float, bool, geo, datetime, text, uuid Filters use payload indexes built before ingestion. Hybrid fuses sparse and dense prefetches with rrf or dbsf
Pinecone New indexes are document indexes; legacy vector indexes still supported Filters narrow the candidate pool before ranking. Hybrid uses one index with a dense vector field and full-text fields
Weaviate HNSW, flat, and dynamic (flat when the dataset is small, HNSW when it is large) Inverted index for BM25 and filter speed. Hybrid fuses vector and BM25F; alpha sets the balance

pgvector is a Postgres extension, and its documentation notes that many hosted providers preinstall it. For the hosting model of the other products, read each product’s install documentation. Full pgvector details are in the pgvector project documentation on GitHub.

Decision table by workload

Match your situation to the first option to test in a vector database for RAG shortlist. Each row still needs your own recall test from the section above.

Your situation First option to test Why
Under 100,000 vectors and a Postgres server already in use pgvector with a flat search first Splunk puts flat search under 100,000 vectors. pgvector keeps vectors beside your app data
Many metadata filters, such as one customer per query Test filtered recall in pgvector and one pre-ranking filter design pgvector filters after an approximate scan, so selective filters need a test
Exact codes, clause numbers or SKUs in questions A database with native hybrid search Weaviate, Qdrant and Pinecone document hybrid fusion as described above
Embedding model above 2,000 dimensions with pgvector A halfvec column (up to 4,000 dimensions), or another product pgvector limits indexed vector columns to 2,000 dimensions
No database team, and you want the vendor to run it A managed service from the product vendor Splunk recommends managed services when there is no DevOps team

Vector database for RAG selection checklist

  1. Count vectors: documents times chunks per document. Use the count you expect in 12 months, not today’s count.
  2. Write the dimensions from your embedding model. Above 2,000 dimensions, pgvector needs the halfvec type.
  3. List every filter your users send and estimate the share of rows each filter keeps.
  4. Decide whether exact terms must match. If yes, make hybrid search a requirement for the shortlist.
  5. Name the person who runs backups, upgrades and on-call. No named owner points to a managed service.
  6. Build a test set of 100 questions, each with the chunk that should be retrieved.
  7. Measure recall on the test set for each candidate, with and without the filters.
  8. Confirm you can export vectors, IDs and metadata, so you can move to another database later.
  9. Write the re-index plan. A change of embedding model changes every vector, so the whole corpus is embedded again.

Illustrative example, not real data: a policy team has 100,000 documents with 5 chunks each, 1,536 dimensions, and filters by business unit and effective date. The raw vectors take about 3.07 GB. They test pgvector with HNSW on the filtered test set first. If filtered queries return fewer than 10 correct chunks, they test a product with pre-ranking filters on the same set.

Mistakes that cost the most

  • Choosing on one vendor benchmark. Benchmarks use their own data, hardware and settings. Your queries decide the result.
  • Skipping the filtered test. An index that looks good on unfiltered queries can return too few chunks once filters apply.
  • Ignoring the dimension limit. A model whose output exceeds 2,000 dimensions does not fit a plain pgvector vector column with an index.
  • Building Qdrant payload indexes after ingestion. Filter-aware HNSW edges come only from indexes created first, so index before you load.
  • Planning no re-index. A new embedding model means every stored vector must be recalculated before retrieval works again.

Who should not build this yet

If you do not need a vector database for RAG yet, because your document set is small, changes rarely and most questions match words in the text, keyword search over the text may be enough. Test it before you add a database. A vector database adds a service to run, a backup to keep and a re-index to plan.

Where AgileFever fits

AgileFever sells a Gen AI BootCamp. Its course page and curriculum list a RAG module that covers vector databases FAISS, Pinecone and Weaviate, RAG pipelines with LangChain and LlamaIndex, and a RAG chatbot project built on a vector database. The course page shows no price, so this post quotes none. Read the current listing on the course page before you decide.

For the pipeline itself, use the RAG pipeline tutorial for engineers. To set up the test set in step 6 of the checklist, read how to evaluate an LLM application. If you are still choosing between RAG and fine-tuning, fine-tuning vs RAG vs prompting explains which fault each method fixes. For interview preparation on retrieval design, use AI engineer interview questions on LLMs, RAG and agents.

Questions people ask

Do I need a vector database for RAG?

Not always. A vector database is one way to store and search embeddings. Small document sets that rarely change can use exact search in application code or in a Postgres table. Splunk’s guide suits flat search under 100,000 vectors. Above that, an approximate index such as HNSW is the usual next step. Test your own questions before you add a new service.

Can pgvector handle RAG?

It can, for many workloads. pgvector supports HNSW and IVFFlat indexes and keeps vectors in the same Postgres database as your rows. Two limits matter. Indexed vector columns hold up to 2,000 dimensions, and filters on approximate indexes run after the scan, so selective filters can return fewer results than you need. Test filtered queries on your data.

What is the difference between HNSW and flat search?

Flat search compares the query with every vector, so recall is 100 percent and the time grows with the vector count. HNSW is an approximate graph index. Splunk gives its recall as 95 to 99 percent, with memory at 2 to 3 times the raw vectors. A flat search is also the baseline you use to measure recall of an approximate index.

Do I need hybrid search for RAG?

Only if your questions contain exact terms such as codes, clause numbers or product names. Vector search matches meaning, and keyword search matches exact words. Weaviate fuses the two with alpha setting the balance. Qdrant and Pinecone merge results with reciprocal rank fusion. Run one exact-code query on each candidate before you decide.

How many vectors can one database hold?

No single number applies, because memory, dimensions and index type set the limit. AltexSoft says performance is good at millions to tens of millions of vectors, and that differences between databases grow at hundreds of millions. To estimate memory, multiply vectors by dimensions by 4 bytes for 32-bit floats, then add index overhead. Test at your own scale.

Should I choose the embedding model or the database first?

Choose the embedding model first. Its output size sets the dimensions, and the dimensions set storage size and which column types work. Changing the model later means embedding the whole corpus again and rebuilding the index. Then choose the database that fits the dimensions, your filters and your team.

Pick the vector database for RAG that passes your own recall test with your real filters, and that your team can run. Everything else in the comparison matters less than those two results.

Contact Us

    By checking the box, you consent to receive registrations, class reminders, updates, support text messages from AgileFever at the provided number. Message and data rates may apply. Message frequency varies (typically 1–2 msgs/week). To end messaging from us, you may always reply with STOP. You may also reply with HELP for more information. Check Privacy Policy and Terms & Conditions.