Vector DB Indexing
Definition
Vector DB Indexing — the creation of specialized data structures (indexes) for efficient vector search based on similarity metrics. Without indexing, linear search becomes impractical with large volumes of data.
Main Index Types
| Type | Principle | Speed | Accuracy |
|---|---|---|---|
| Flat | Full scan | Low | High |
| HNSW | Small-world graph | High | High |
| IVF | Inverted file | High | Medium |
| PQ | Product quantization | Very high | Low |
Indexing Parameters
- Distance metric: cosine, Euclidean, dot product.
- Number of clusters (for IVF).
- Graph size (for HNSW).
- Number of subspaces (for PQ).
Process
- Vectors are added to the database.
- An index is built based on the selected algorithm.
- During search, the index narrows down candidates, followed by exact ranking.