Design a database that tracks changes to resources
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Microsoft's system design round, last asked Jan 2026. It tests change tracking, databases and auditing.
Design a store that records every change to a set of resources (for example cloud resources or configuration objects, represented as JSON) so users can see a resource's history, see what changed between versions, and see its state at any past time. Changes come from many sources and can arrive late, out of order or more than once.
Requirements
- Functional: capture each create, update and delete with who made it and when; show a resource's history and the diff between versions; return the state of one resource, or of all resources, as of a past time; query changes by resource, type, user and time range.
- Non-functional: no lost or duplicated changes; correct ordering per resource; scalable to billions of change records; retention and storage growth under control; an audit trail that cannot be silently altered.
Clarifying questions
- Do we receive full snapshots, diffs, or both?
- How do changes arrive: from a database's change stream, events emitted by services, or periodic polling?
- What ordering guarantees do sources give (per-resource version numbers, timestamps)?
- How far back must point-in-time queries go, and how fast must they be?
- Are there compliance requirements on immutability?
What a strong answer covers
- Capture: change data capture or events into a durable log, each change with resource id, a per-resource version or sequence, timestamp, actor and payload.
- Idempotency and ordering: deduplicate by an event id, order per resource by its version, and handle late or out-of-order events by inserting into history rather than overwriting.
- Data model: an append-only change table keyed by
(resource_id, version), plus periodic full snapshots so state as of time T is the latest snapshot before T plus the changes after it. - Diffs: computed at write time (JSON Patch) or at read time from two snapshots, with the cost of each.
- Indexes for resource, type, actor and time queries, partitioning by time and resource, and tiering old history to cheap storage with retention rules.
- Audit integrity: append-only permissions, hash chaining or write-once storage.
Follow-ups
- Show the state of all 10 million resources as of last Tuesday at noon. How fast can you make it?
- A source replays a day of events after an outage. What happens?
- Users want to be notified when a specific field changes.
- A resource is renamed or its id changes. How does history follow it?
Where it's asked
- Microsoft · System design · Last asked Jan 202660 min · Design discussion
What it tests
change tracking · databases · auditing
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
