Prompt
Why is my vector search slow after adding more embeddings?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
Vector search often gets slower as you add more embeddings because the system has more data to compare against, and the cost depends on both how many vectors you store and how the index is built/tuned.
Common reasons:
-
Brute-force or near-brute-force retrieval
- If your setup scans a large portion of the vector store for each query, latency grows roughly with the number of embeddings.
-
Index not optimized for scale
- Some indexes work well at smaller sizes but slow down if parameters aren’t tuned for larger datasets.
- Examples: HNSW, IVF, PQ, or flat indexes may need different settings as corpus size grows.
-
Higher dimensional vectors
- More dimensions mean more computation per similarity check.
- If you increased embedding dimension, that also raises query cost.
-
Poor filtering strategy
- If metadata filters are applied after retrieval instead of before, the search engine may still evaluate many candidates.
-
Memory pressure / disk spill
- When the index no longer fits in memory, searches may hit disk more often, which is much slower.
-
Concurrency/load effects
- More embeddings can also mean more ingestion, more fragmented indexes, or more concurrent queries competing for CPU and memory.
-
Rebuilding/fragmentation issues
- Frequent inserts/deletes can fragment the index or leave it suboptimal until compaction/rebuild.
How to improve it:
- Use an ANN index tuned for your scale (e.g. HNSW, IVF, ScaNN, FAISS, Annoy, depending on your stack).
- Re-tune index parameters like:
- HNSW:
ef_search,M - IVF: number of clusters / probes
- PQ: compression settings
- HNSW:
- Reduce candidate set with better metadata filtering or pre-partitioning.
- Consider smaller embeddings if acceptable.
- Keep the index in memory if possible.
- Batch inserts and periodically rebuild/compact if your system benefits from it.
- Benchmark recall vs latency to find a good tradeoff.
If you want, I can help diagnose the likely bottleneck if you share:
- the vector database / library,
- number of embeddings,
- embedding dimension,
- index type and settings,
- and typical query latency before vs after growth.