ai-ml pattern

Vector Databases

Store and query high-dimensional embeddings for semantic search. Core infrastructure for AI apps.

Time

O(log n) for HNSW queries

Space

O(n × dimensions)

🧠Mental Model

A library organized by meaning, not alphabet - similar books are physically near each other.

Verbal cue: Embed, index, query by similarity.

🎯Recognition Triggers

When you see these patterns in a problem, consider this approach:

vector DBPineconeWeaviateembeddingssemantic searchsimilarity

💡Interview Tips

  • 1Know at least 2-3 vector DB options and their trade-offs
  • 2Understand embedding dimensions and their impact
  • 3Mention approximate vs exact search trade-offs

⚠️Common Mistakes

  • Not choosing the right similarity metric for your use case
  • Ignoring metadata filtering (namespace, date, etc.)
  • Not batching upserts for performance