Skip to content

Vector Databases

PART 16 — Vector Databases

A Vector DB stores float32[] arrays and performs K-Nearest Neighbor (KNN) searches.

  • Exact Search: O(N) scan. Too slow for billions of rows.
  • ANN (Approximate Nearest Neighbor): Vector DBs use graph-based indexes, primarily HNSW (Hierarchical Navigable Small World).
  • SDE Analogy: HNSW is a Skip-List in multi-dimensional space. It creates multiple layers of graphs. You find a broad neighborhood in the top layer, drop down a layer, and refine the search, achieving logarithmic O(log N) search time.