01. Why Build a Vector DB?
Chapter 1 of 18 · 15 min
You're probably here because someone told you to use a vector database, and you want to understand what actually happens when you call that add or search method. Smart move. The gap between "it works" and "I understand why it's slow" is where production incidents live.
EXERCISE
Install FAISS or usearch and index 100k random vectors. Run a search and note the latency. Then index 1M vectors and note how latency changes. You won't understand why yet—but you'll have a baseline.
# Minimal FAISS index creation
import faiss
import numpy as np
# Create 100k 128-dim vectors (pretend these are embeddings)
vectors = np.random.rand(100000, 128).astype('float32')
# Build a brute-force index to establish baseline
index = faiss.IndexFlatL2(vectors.shape[1])
index.add(vectors)
# Query
query = np.random.rand(1, 128).astype('float32')
distances, indices = index.search(query, k=10)
print(f"Top 10 indices: {indices[0]}")
print(f"Top 10 distances: {distances[0]}")