# Design a vector database: system design interview question

> Approximate vector search with metadata filters: search quality, query time, and visibility of recent changes.

Source: https://sysround.com/questions/design-vector-database
Updated: 2026-11-05


Difficulty: hard. Levels: Senior, Staff+.

## How the interviewer opens it

"Design a database that stores embeddings and returns similar items through approximate nearest-neighbor search. Clients must also filter the results by metadata."

## What to clarify first

- Operations and distance
- Data size and tenants
- Traffic and read:write mix
- Metadata filters
- Search quality
- Query time
- Freshness and availability
- Durability
- Index changes
- Exclusions

## Scope of a strong answer

Core requirements:

- Store, replace, read, and delete vectors by tenant and record ID
- Return the nearest vectors that satisfy metadata filters
- Meet the stated recall, query time, and freshness targets
- Keep each tenant's data separate from other tenants

Usually out of scope:

- Create embeddings or train models
- Combine vector search with text search
- Support arbitrary SQL queries or joins
- Operate across multiple regions

## What interviewers probe

### Search results with filters

The nearest vectors may fail the filter. A selective filter can also make graph search miss valid neighbors.

### Search quality and query time

Search effort improves recall but consumes query time and CPU. Filters and tenant size change that trade-off.

### Changes to stored vectors

Writes must survive failures before search sees them. Updates and deletes must remain correct during index replacement.

### Queries across tenants and shards

A large tenant can span shards. Every shard affects global recall and query time, while small tenants need little search work.

## Common mistakes

- Measure recall against unfiltered neighbors instead of the exact filtered result set.
- Treat a filter as a final step after a fixed-size ANN result.
- Treat an ANN index as the only durable copy of the records.
- Ignore obsolete vectors and delete markers during index replacement.
- Size memory from vector bytes alone and ignore replicas, graphs, and metadata indexes.
- Search every shard without a tenant route or a plan for slow shards.

## The bar by level

- **Senior:** Designs filtered search with exact-scan fallback. Sizes memory and replicas. Defines recall tests, write visibility, version checks, recovery, and complete results across shards.
- **Staff+:** Defines quality and freshness contracts under overload and failure. Designs safe index replacement and tenant moves. Uses measurements to choose memory, recall, and query-time trade-offs.

Practice this question with an AI interviewer: https://sysround.com/practice/new?problem=vector-database


---
SysRound (https://sysround.com) is an AI practice tool for system design interviews. It has a voice or typed AI interviewer and a shared whiteboard. At the end, you get feedback on each skill and a model answer. The AI feedback can be wrong.
