Vector search, as performed by a vector database, is the operation of finding the stored vectors closest to a query vector using an efficient index — distinct from embedding search, which describes the application-level pattern (embed, compare, retrieve) that vector search implements underneath.
The Query Flow at the Database Level
from vector_db_client import Collection # conceptual, not tied to
# a specific provider's SDK
collection = Collection("support_articles")
query_vector = embed("how do I reset my password")
results = collection.query(
vector=query_vector,
top_k=5,
filter={"category": "account"} # optional metadata filter
)
for r in results:
print(r.id, r.score, r.metadata)
The database handles the actual similarity computation and ranking internally, using its index — your application just sends a vector and gets back ranked matches.
Exact vs Approximate Search
| Exact Search | Approximate Search | |
|---|---|---|
| Accuracy | Always finds the true closest matches | Very likely finds them, with a small, tunable chance of missing the absolute best match |
| Speed at scale | Slower as data grows (approaches brute force) | Much faster, especially at large scale |
| Typical use | Small datasets, or where perfect accuracy is essential | Most production systems at meaningful scale — see Approximate Nearest Neighbor |
Practical Use Case
Every RAG retrieval step, every semantic search feature, and every "find similar items" recommendation feature ultimately issues a vector search query like the one above — it's the single most-executed operation in any embeddings-based application.
Common Mistakes
- Not using metadata filtering when it's available and relevant, forcing a broader (slower, less precise) search than necessary
- Requesting a much larger
top_kthan actually needed, adding unnecessary latency and downstream processing
Interview Relevance
"What does a vector database actually do when you run a search query?" — computing similarity against an index (not a linear scan, at scale) and returning ranked top-k results, optionally filtered by metadata, is the expected shape of the answer.
Practice Question
Write a vector search query (conceptual code) that retrieves the top 3 most relevant chunks from a "product_manuals" collection, filtered to only chunks from manuals in the "electronics" category.