ANN index
An ANN (approximate nearest neighbor) index is the data structure inside a vector DB that returns 'almost-best' matches in sub-millisecond time — HNSW, IVF, ScaNN, DiskANN are 2026 popular implementations.
Exact nearest-neighbor search is O(N) — scan every vector. At 100M vectors, that's seconds per query. ANN indexes trade a small accuracy loss (typically 90-99% recall@10) for 100-1000× speedup. Common families: HNSW (Hierarchical Navigable Small World — fast, accurate, RAM-heavy, default in most modern DBs), IVF (Inverted File — clusters then searches within cluster — faster builds, larger), ScaNN (Google's hybrid — strong recall at low latency), DiskANN (disk-friendly for billion-scale). Tuning matters: HNSW's ef_construction + M parameters trade build time vs query speed vs accuracy. Modern vector DBs hide most of this; production teams still benchmark on their dataset to choose.
When to use ann index
- Any vector search > 1M vectors.
Common mistakes
- Picking default params blind — workload-tuned ANN can be 5× faster.
- Not measuring recall — silent quality regressions.
FAQ
What is ann index?
An ANN (approximate nearest neighbor) index is the data structure inside a vector DB that returns 'almost-best' matches in sub-millisecond time — HNSW, IVF, ScaNN, DiskANN are 2026 popular implementations.
When should I use ann index?
Any vector search > 1M vectors.
What are the most common mistakes with ann index?
Picking default params blind — workload-tuned ANN can be 5× faster. Not measuring recall — silent quality regressions.
Related terms
- Vector database — A vector database stores embeddings and performs approximate nearest-neighbor search at scale, the persistence layer behind RAG and semantic search.
- Embeddings — Embeddings are dense numeric vectors that represent the meaning of text, images, or other data, allowing similarity to be measured as vector distance.
- PagedAttention — PagedAttention is vLLM's memory-management technique that partitions the KV cache into fixed-size pages — borrowed from OS virtual memory — to eliminate fragmentation and enable efficient KV-cache sharing.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/ann-index.md.