Skip to content

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

  1. Vectors are added to the database.
  2. An index is built based on the selected algorithm.
  3. During search, the index narrows down candidates, followed by exact ranking.

See Also

← All terms