Data Modelling From Access Patterns

Topics Covered

Why the Data Model Matters

What interviewers look for

From calls to entities

Relationships and cardinality

The order of steps

How the estimate feeds in

Common mistakes

A short example exchange

The data model as a design tool

What a missing data model costs

Thinking in reads per second

The data model is where trade offs become concrete

Access Patterns Before Schemas

Writing access patterns

Hot and cold patterns

Keys follow patterns

When patterns conflict

Patterns that need a different system

Write patterns matter too

A worked example: ride sharing

Saying patterns out loud

A worked example: a URL shortener

Patterns with time windows

Checking the list

Choosing a Store for Each Entity

Relational databases

Key value and wide column stores

Document stores

Object storage

In memory stores and caches

Search indexes, time series and warehouses

Choosing per entity

Consistency needs per entity

Avoiding brand debates

When the interviewer pushes back

Combining stores without inconsistency

A note on caches as stores

Graph shaped data

Saying the choice in one line

Keys, Partitions and Denormalisation

Primary keys and IDs

Choosing a partition key

Hot partitions

Avoiding bad partition keys

Secondary access

Denormalisation

Counters and aggregates

Materialised views and precomputation

Explaining the trade off

A worked example: a chat app

Rebalancing as data grows

Presenting the Data Model

A compact notation

Walking through it

How much detail

Connecting to the high level design

Connecting to the deep dives

Evolving the model

A sample walkthrough

A checklist before moving on

Practising the step

Adapting to the interviewer

Common follow up questions

The data model as the backbone

In most system design interviews, the hardest problems are in the data layer. Application servers are stateless and scale by adding more of them. Data does not scale that way. Where data lives, how it is keyed, which copies exist and how they stay consistent decide whether the system is fast, correct and affordable. That is why interviewers pay close attention to the data model, and why a few careful minutes on it often separate a good design from a great one.

This lesson shows how to derive the data model from the API and the access patterns, how to choose a store for each entity, how to pick keys and partition keys, when to denormalise, and how to present the result on the board in a few lines.

What interviewers look for

Interviewers are not looking for a full schema with every column and type. They are looking for evidence that you understand three things. First, which entities exist and how they relate. Second, how the data will be read and written, and therefore how it should be keyed and indexed. Third, which store fits each entity and why. A candidate who writes five tables with thirty columns but never says how the feed is looked up has missed the point. A candidate who writes three entities with their keys and explains how the hottest read is served in one lookup has hit it.

From calls to entities

Start with the API. Each call reads or writes something, and those somethings are your entities. POST posts writes a post. POST follow writes a follow relationship. GET feed reads feed items for a user. GET posts by ID reads a post. Listing the entities this way takes a minute and guarantees that every entity in your model is needed by some call, and every call has the data it needs.

The API tells you which entities exist.

Some entities are not obvious from the calls but appear when you think about how a call is served. GET feed suggests either a precomputed feed per user, which is an entity of its own, or a query that merges recent posts from everyone the user follows. Which one you choose is a major design decision, and the data model is where it first becomes concrete.

Relationships and cardinality

Note the relationships between entities and their rough cardinality. A user has many posts. A user follows many users, and is followed by many, sometimes by millions. A conversation has many messages and a few to a few thousand members. An order has a few items and one payment. Cardinality matters because it determines how relationships are stored and queried. A one to few relationship can often be embedded in the parent. A one to many relationship with unbounded size needs its own table or partition, with pagination. A many to many relationship needs an edge table, possibly stored twice, once in each direction, if both directions are queried often.

The order of steps

A reliable order is: list entities from the API, write the access patterns for each, choose a store for each entity, choose keys and partition keys, and decide on any denormalisation. In a forty five minute round, the whole step takes about five minutes. You do not need to complete it before drawing the high level design. Many candidates sketch the core entities first, draw the architecture, and return to the data model as the design takes shape. What matters is that by the end, each important entity has a store, a key and a reason.

How the estimate feeds in

The numbers from your estimate feed directly into the data model. Total storage tells you whether an entity fits on one machine or must be partitioned. Write rates tell you whether a single primary can take the writes. The read to write ratio tells you whether denormalising for reads is worth the extra write work. If you estimated eleven petabytes of photos and a terabyte of metadata, you already know photos go to object storage and metadata to a database. If you estimated ten thousand message writes per second, you already know messages need a partitioned store. Say these connections as you make each choice.

Common mistakes

The first common mistake is designing the schema before knowing the access patterns, which leads to tables that are normalised beautifully but cannot serve the hot read efficiently. The second is choosing one database for everything without considering whether it fits each entity. The third is ignoring the partition key, or choosing one that creates hot spots. The fourth is going too deep: thirty columns and their types while the architecture is not yet drawn. The fifth is the opposite: no data model at all, so the design never says where anything lives. This lesson addresses each of these.

A short example exchange

Interview Dialogue

CandidateFrom the API, the entities are users, posts, follows and a precomputed feed per user. The hot read is the feed: one user, newest first, twenty at a time. So the feed table is keyed by user ID with time as the sort key, and I would put it in a wide column store, since it is a huge number of simple lookups.
InterviewerClick to reveal answer
CandidatePosts are written rarely and read by ID, so a relational store works and keeps things simple. The photos themselves are in object storage; posts only hold the URL.
Show all answers

The candidate named the entities, identified the hot pattern, chose keys and stores with reasons and moved on. That is a complete data model step for a first pass.

The data model as a design tool

Think of the data model not as documentation of a design you have already chosen, but as a tool for choosing it. Many architectural decisions become obvious once the data model is clear. If the feed is a precomputed table keyed by user, a fan out service must write to it when someone posts. If messages are partitioned by conversation, the delivery service must look up which partition holds a conversation. If orders and payments are in one relational database, a single transaction can keep them consistent. Working out the data model first, or in parallel with the boxes, often means the architecture almost draws itself.

What a missing data model costs

Consider what happens when a candidate skips this step. They draw a client, a load balancer, a post service, a feed service and a box labelled database. When the interviewer asks how the feed service finds the twenty newest posts from everyone a user follows, the candidate says it queries the database. Which table, keyed how? It joins follows to posts and sorts by time. For a user who follows five hundred accounts, that is a large query on every feed load, thousands of times a second. The interviewer now has to lead the candidate toward precomputed feeds, partition keys and caching, and the candidate gets less credit for each idea, because it was prompted. A few minutes of data modelling would have surfaced the problem and the solution together, on the candidate's own initiative.

Thinking in reads per second

A habit that helps throughout this step is to ask, for each hot read, how many records it touches. A feed read that touches one partition and returns twenty items is cheap. A feed read that queries five hundred authors and merges the results is expensive, even if each individual query is fast. Multiply by the read rate from your estimate. Twenty items from one partition, five thousand times a second, is easy. Five hundred queries, five thousand times a second, is two and a half million queries a second, which is not. This simple multiplication is often the clearest way to justify precomputation, denormalisation or caching, and it uses the numbers you already wrote on the board.

The data model is where trade offs become concrete

Earlier steps talk about trade offs in general: consistency against availability, latency against cost. The data model is where they become concrete. Choosing to store an edge twice is a concrete trade of write cost for read speed. Choosing a wide column store for messages is a concrete trade of query flexibility for scale. Choosing a relational database for orders is a concrete choice of transactions over horizontal write scaling. Naming each trade as you make it is one of the clearest ways to show the judgment that interviewers are scoring.

Start from the hot read

Find the single most frequent or latency sensitive read in the system and design its key first. If that read can be served with one lookup by key, the rest of the data model usually falls into place around it.

The single most important habit in data modelling for interviews is to write the access patterns before choosing a schema or a store. An access pattern is a description of how data is read or written: get the feed for a user, newest first, twenty at a time; get all messages in a conversation after a given time; increment the like count for a post; find all drivers within two kilometres of a point. Each one implies a key, a sort order and an index. Once the patterns are written, the schema usually follows directly.

Writing access patterns

For each entity, write the ways it will be read and written, in plain words. Include the key you look up by, the sort order if there is a list, the expected rate and whether the pattern is on a latency sensitive path. You do not need many. Most systems have three to six patterns that matter. The rest are rare enough to serve with a slower path.

List how data is read before choosing where it lives.

For a social feed: read the feed for a user, newest first, very hot. Read posts by an author, newest first, warm, for profile pages. Read a post by ID, hot, for detail views and for assembling feeds. Read followers of a user, hot during fan out. Read who a user follows, warm, for the following page. Write a post, low rate. Write a follow, low rate.

Look at this list, and the data model nearly writes itself. The feed needs a table keyed by user with time ordering. Posts need lookup by ID and by author with time ordering. Follows need lookup in both directions, so the edge is stored twice or indexed both ways.

Hot and cold patterns

Mark which patterns are hot, meaning high rate or latency sensitive, and which are cold. Hot patterns should be served by a single key lookup or a short range scan on one partition, ideally from cache. Cold patterns can afford a secondary index, a scatter gather query across partitions, or even an offline job. For example, a profile page that lists a user's posts is warm; a moderator search across all posts for a word is cold and can go to a search index updated asynchronously. Interviewers like to hear this distinction, because it shows you are spending design effort where traffic is.

Keys follow patterns

Each hot pattern suggests its key. Feed for a user, newest first: partition key user ID, sort key time. Messages in a conversation, after a time: partition key conversation ID, sort key time or a sequence number. Post by ID: primary key post ID. Drivers near a point: a geospatial index, such as a grid cell or geohash as the key, with drivers listed under the cell. Writing the key next to the pattern makes the connection explicit and easy for the interviewer to check.

When patterns conflict

Sometimes two hot patterns want different keys for the same data. Followers of a user and users followed by a user are both needed, but one is keyed by the followed user and the other by the follower. The common solution is to store the data twice, once for each pattern, and keep both copies updated when a follow is created or removed. Another is a secondary index, which the database maintains for you, at some cost to writes. In interviews, say which you choose and why: follows are written rarely and read in both directions, so I will store the edge twice, keyed each way.

Patterns that need a different system

Some patterns are a poor fit for any primary database and should go elsewhere. Full text search across posts belongs in a search index. Nearby queries for moving objects belong in a geospatial index or an in memory grid. Analytics over months of events belong in a columnar warehouse. Top trending items over the last hour belong in a stream processor with windowed counts. Recognising that a pattern needs its own system, and saying how data reaches it, usually through change data capture or an event stream, is a strong signal.

Write patterns matter too

Do not forget writes. A write pattern that hits one row very often, such as incrementing a like counter on a viral post, creates a hot row that no database handles well at very high rates. A write pattern that touches many rows, such as fanning a post out to millions of follower feeds, creates a burst of work. A write pattern that must update several entities atomically, such as moving money between two accounts, requires a transaction or a careful sequence of steps. Writing these down alongside the reads tells you where the difficult parts of the data model are.

A worked example: ride sharing

For a ride sharing app, the access patterns might be: update a driver's location every few seconds, very hot write; find available drivers near a rider, very hot read; create a trip when a driver accepts, low rate, must not double assign a driver; read a trip's status, hot during a trip; read a rider's trip history, cold.

From this list: driver locations go into an in memory geospatial index keyed by grid cell, overwritten on each update rather than stored as history. Trips go into a relational database, because assigning a driver to a trip must be atomic and conditional on the driver being available. Trip status is read by trip ID, cached during the trip. Trip history is read by rider ID with time ordering, served by an index on the trips table or a separate history store. The patterns made each choice obvious.

Saying patterns out loud

As you write the patterns, say them briefly. The hot read is a rider looking for nearby drivers, thousands of times a second; the hot write is driver location, hundreds of thousands a second. Those two patterns decide the core of the data layer. Everything else is modest. This framing tells the interviewer you know where the difficulty lies and sets up the store choices that follow.

A worked example: a URL shortener

Even a simple system benefits from writing patterns first. For a URL shortener: resolve a short code to a long URL, extremely hot, latency sensitive, roughly a hundred times the write rate; create a short link, low rate, must not collide with an existing code; list a user's links, cold; count clicks per link, hot write, read occasionally on a dashboard.

From the list: the link table is keyed by short code, which is the only key the hot read uses, and sits behind a cache, since the hot set fits in memory. Creation needs a uniqueness guarantee on the code, which a primary key constraint or a conditional write provides. Listing a user's links uses a secondary index on user ID, acceptable because it is cold. Click counts are not written to the link row on every redirect; click events go to a log and are aggregated asynchronously, so the hot read path stays a pure lookup. Four patterns, four decisions, under two minutes.

Patterns with time windows

Many access patterns involve time windows: messages in the last day, trending topics in the last hour, a user's activity this month. Time windows suggest a sort key on time and often a retention policy, since old data can move to cheaper storage or be deleted. When a pattern has a window, say how old data is handled: messages older than a year move to cold storage and load more slowly; trending counts use a sliding window and discard older buckets. This links the data model to cost and storage tiering, which interviewers increasingly ask about.

Checking the list

When the list is written, read it once against the API. Every call should map to at least one pattern, and every hot pattern should map to a call or a background job. A pattern with no call behind it is probably not needed; a call with no pattern means a read or write has been forgotten.

Rare patterns can be slow

Not every query needs to be fast. Serve the hot patterns with a single key lookup or short range scan, and let rare patterns, such as admin searches or monthly reports, use a secondary index, a scatter gather query or an offline job.

Once you know the access patterns, choose a store for each entity. The point is not to name the most impressive technology. It is to match each entity's patterns, scale and consistency needs to a store that serves them well, and to say why in a sentence. Many good designs use two or three kinds of store, each for the data it fits best.

Relational databases

A relational database is the sensible default for most entities with moderate scale and meaningful relationships. It gives you transactions, constraints, joins, secondary indexes and decades of operational maturity. Users, orders, payments, bookings, inventory and account balances usually belong here, because correctness matters and the write rate is within what one primary, or a few partitions, can handle. A single relational primary with read replicas can serve a surprising range of products, especially when combined with a cache.

Pick the store that serves the hot patterns.

Choose relational when you need transactions across rows, such as reserving stock and creating an order together, when the data has many relationships you query in different ways, or when the scale fits. Say so: orders and payments go in a relational database, because creating an order and recording the payment intent must be atomic.

Key value and wide column stores

Key value and wide column stores trade query flexibility for scale. You look data up by a key, sometimes with a sort key for range scans within a partition, and the store spreads partitions across many machines automatically. They handle enormous write and read rates and enormous data sizes, as long as your access patterns are simple lookups by key.

Choose them for entities with huge volume and simple patterns: messages by conversation, feed items by user, events by device, sessions by ID. Say what the partition key and sort key are, because those are what make the store work: messages partitioned by conversation ID, sorted by time.

Document stores

Document stores hold self contained records, often JSON, keyed by ID, with some support for secondary indexes. They fit entities that are read and written as a whole and have flexible or nested structure, such as product listings with varying attributes, user preferences or content items. They are less suited to data with many cross entity relationships and transactions, though many now support some transactions. In interviews, a document store is a reasonable choice when the entity is naturally a document, but rarely the only right choice.

Object storage

Large binary content, such as photos, videos, audio, documents and backups, belongs in object storage. It is cheap per gigabyte, highly durable and scales to petabytes. Store the bytes there and keep only metadata and a reference in a database. Serve popular content through a content delivery network. Almost every design with user uploaded media uses this split.

In memory stores and caches

In memory stores serve very hot data with very low latency. They are used as caches in front of a database, as primary stores for ephemeral data such as driver locations, presence and session state, and for counters and rate limits. Say whether the in memory data can be lost: a cache can always be rebuilt from the database, but if the in memory store is the only copy, decide what happens on failure. For driver locations, losing a few seconds of updates is fine, because drivers send new ones constantly.

Search indexes, time series and warehouses

Some patterns call for specialised stores. A search index serves full text search and faceted filters. A time series database serves metrics with high write rates and time range queries. A columnar warehouse serves analytics across large historical datasets. A graph database can serve complex relationship queries, though most social graphs in interviews are served well enough by edge tables. These stores are usually fed from the primary data asynchronously, so name how data reaches them.

Choosing per entity

The most common mistake is choosing one store for the whole system. A strong design often looks like this: users, orders and payments in a relational database; messages or feeds in a wide column store; media in object storage; hot data in an in memory cache; search in a search index. Each choice follows from the entity's patterns. This does not mean you should use many stores for the sake of it. Each additional store has an operational cost. Use the fewest stores that serve the patterns well, and be ready to say why each one earns its place.

Consistency needs per entity

Different entities need different consistency. Account balances, inventory and bookings need strong consistency and transactions; overselling or double spending is unacceptable. Feeds, like counts and view counts can be eventually consistent; a few seconds of delay is invisible. Profiles and settings usually need read your writes for the user who changed them, but can be eventually consistent for others. Stating the consistency need per entity, as you choose its store, links the data model to the non functional requirements and justifies the choice.

Avoiding brand debates

You can name specific products if you know them, but focus on the properties. Saying a wide column store partitioned by conversation is clearer than naming a product without saying how it will be used. If the interviewer asks which product, name one you know and explain why its properties fit. Interviewers rarely care about the brand. They care that you understand what the store does and why it fits.

When the interviewer pushes back

If the interviewer asks why not just use one relational database for everything, take the question seriously. Often the honest answer is that a relational database would work at first, and you would only move an entity to another store when its scale demanded it. At the scale we estimated, messages exceed what one primary can take, so they need a partitioned store; users and orders do not, so they stay relational. That answer shows you are choosing stores for reasons, not habit.

Combining stores without inconsistency

Using several stores raises a question interviewers like to ask: how do the copies stay consistent? If a post is written to the relational database and must also appear in the search index and the feed table, what happens if one write succeeds and another fails? The common answer is to write once to the source of truth and propagate changes asynchronously, either through change data capture from the database's log or through an outbox table written in the same transaction and published by a separate process. Downstream stores are then eventually consistent with the source, and a failed update can be retried from the log. Avoid having the application write to several stores directly in sequence, because a crash between writes leaves them out of step with no record of what was missed.

A note on caches as stores

A cache is not a source of truth, and the data model should say so. When you add a cache in front of a store, name what is cached, how it is keyed, how entries expire and what happens on a miss. The feed cache holds the first page of each active user's feed, keyed by user ID, expiring after a few minutes, rebuilt from the feed table on a miss. That sentence is enough, and it tells the interviewer you know the cache can be lost without losing data.

Graph shaped data

Social graphs, recommendation graphs and organisational hierarchies are sometimes presented as a reason to use a graph database. In most interviews, the queries are one or two hops, such as followers of a user or friends of friends, and edge tables keyed by user serve them well at scale. A graph database earns its place when queries traverse many hops or need flexible path matching. Say which kind of query you have before choosing.

Saying the choice in one line

However many stores you use, each choice should fit in one line on the board and one sentence aloud: the entity, the store and the reason.

Store choices by level

Mid level candidates pick a reasonable store and say why. Senior candidates choose per entity from access patterns and consistency needs, and name partition and sort keys. Staff candidates also weigh the operational cost of each extra store, migration paths as scale grows and how data flows between stores without inconsistency.

Choosing the right store is half the data model. The other half is choosing keys, partition keys and copies. These decisions determine whether the hot patterns are fast, whether load spreads evenly and whether the system can grow. They are also where interviewers most often probe, because they reveal whether a candidate has operated data at scale.

Primary keys and IDs

Every entity needs an identifier. For most entities, a unique ID generated by the system works. The interesting questions are how IDs are generated at scale and whether they encode anything useful. Auto incrementing integers are simple on one database but need coordination across partitions. Random identifiers such as UUIDs need no coordination but are not ordered. Time ordered IDs, which put a timestamp in the high bits, are unique without coordination and sort roughly by creation time, which helps range scans and pagination. In feeds and chat, time ordered IDs are a common choice. Mention it in a sentence if ordering matters.

Choosing a partition key

When an entity is partitioned, the partition key decides which partition each record lives on. A good partition key does two things. It spreads load evenly, so no partition is much busier than the rest. And it keeps data that is read together on the same partition, so hot reads touch one partition instead of many.

The partition key decides what lives together.

For messages, partitioning by conversation ID keeps each conversation's messages together, so reading a conversation hits one partition, and spreads millions of conversations across partitions. For feeds, partitioning by user ID keeps each user's feed together. For orders, partitioning by customer ID keeps a customer's orders together. These are natural choices because the hot reads are scoped to one conversation, one user or one customer.

Hot partitions

Even a good partition key can create hot spots. A group chat with a hundred thousand members, a celebrity's follower list, a product in a flash sale: each concentrates traffic on one partition. Interviewers often ask about this, because it is the classic failure of a partition scheme. Common answers include splitting a hot key into several sub keys, such as appending a bucket number, caching hot reads in front of the partition, handling very large entities on a separate path, and rate limiting writes to the hot key. Naming the hot partition risk before the interviewer asks is a strong signal.

Avoiding bad partition keys

Some partition keys look reasonable but fail. Partitioning by time, such as by day, sends all of today's writes to one partition. Partitioning by a low cardinality field, such as country, gives a few huge partitions. Partitioning by something the hot read does not include forces every read to query every partition. When you choose a key, check it against the hot read and the write distribution: does the hot read include this key, and do writes spread evenly across its values?

Secondary access

Partitioning by one key makes other access patterns harder. If messages are partitioned by conversation, finding all messages sent by one user requires querying every partition, or maintaining a second copy keyed by user. Decide whether that pattern is hot enough to deserve its own copy or rare enough to serve with a scatter gather query or an offline job. This is the same trade off as storing edges twice, and it should be stated the same way.

Denormalisation

Normalisation stores each fact once and joins at read time. Denormalisation stores copies of facts where they are read, so reads need no joins. In a high scale read path, denormalisation is often the right choice. A feed item might store the author's name and avatar URL along with the post ID, so the feed can be rendered from one lookup without fetching each author.

Copying data trades write work for fast reads.

The cost is keeping copies in sync. If a user changes their name, every copy must eventually be updated, usually by a background job, and readers may see the old name for a while. That is acceptable when the copied data changes rarely and the read path is very hot. It is not acceptable for data that must always be consistent, such as prices at checkout. Say which you are doing and why: the feed stores author names because feeds are read constantly and names change rarely; a rename updates copies in the background.

Counters and aggregates

Counts such as likes, views and followers are a special case. A single row incremented a hundred thousand times a second becomes a bottleneck. Common approaches are to batch increments in memory or through a queue and apply them every few seconds, to shard the counter into several rows summed on read, or to accept an approximate count shown to users while an exact count is computed asynchronously.

Hot counters need batching, not a row update per event.

Separately, the fact that a user liked a post should be stored once per user, so a like is idempotent and can be undone. The displayed count is derived from those facts, but served from a batched counter for speed.

Materialised views and precomputation

A materialised view is a precomputed result kept up to date as the underlying data changes. The precomputed feed per user is one. A leaderboard sorted by score is another. A daily summary of sales is a third. Precomputation moves work from read time to write time, which is the right trade when reads vastly outnumber writes. Say what triggers the update, usually an event when the underlying data changes, and how stale the view can be.

Explaining the trade off

Every one of these decisions is a trade off between read cost, write cost, storage and consistency. Interviewers listen for whether you name the trade off. Storing the edge twice doubles follow writes but makes both directions a single lookup. Denormalising author names makes feeds one lookup but means renames propagate with delay. Batching like counts makes counts slightly stale but removes a hot row. One sentence per decision, naming what you gain and what you pay, is enough.

A worked example: a chat app

Bringing the pieces together for a chat app: message IDs are time ordered, so they sort within a conversation and need no central counter. Messages are partitioned by conversation ID and sorted by message ID, so loading a conversation is a range scan on one partition. Conversation membership is stored twice: by conversation, for delivering a message to its members, and by user, for listing a user's conversations. Each user's conversation list is denormalised with the last message preview and timestamp, so the inbox renders in one lookup; it is updated whenever a message is sent. Unread counts are per user per conversation and updated in batches. Very large channels get their message reads cached and their deliveries handled by a broadcast path. Each of these is a sentence, and together they make the data model for chat complete.

Rebalancing as data grows

Partitions do not stay balanced forever. Data grows, some keys become hotter and machines are added. Stores handle this with consistent hashing, which moves only a fraction of keys when a node is added, or with range splitting, which divides a busy range into two. You rarely need the details, but a sentence shows you know partitions must move: the store splits and rebalances partitions as they grow, so adding capacity does not require a full reshuffle.

Check the partition key against the hot read

Before committing to a partition key, check that the hot read includes it and that writes spread evenly across its values. Keys such as date or country often fail one of these tests and create hot partitions or scatter reads.

A good data model is only useful if the interviewer can see it. This section covers how to put it on the board compactly, how to walk through it, how much detail to include and how to connect it to the rest of the interview.

A compact notation

Write each entity on one line: its name, its key, its most important fields and its store. User (id) relational. Post (id, author_id, created_at, media_url) relational. Feed (user_id partition, created_at sort, post_id, author_name) wide column. Follow (follower_id, followee_id) stored both ways. Mark partition keys and sort keys clearly, because they carry the most design meaning.

A few lines on the board capture the data model.

Five or six lines usually cover the core of a design. Columns that do not affect any decision, such as created by, updated by or display preferences, can be left out. If the interviewer wants more, they will ask.

Walking through it

As you write the data model, say why each key and store was chosen, tied to an access pattern. The feed table is keyed by user ID with time as the sort key, because the hot read is one user's feed newest first. Follows are stored both ways because both directions are read often. Media lives in object storage; the post holds the URL. These sentences are short, but they turn a list of tables into a set of decisions the interviewer can evaluate.

How much detail

Aim for enough detail to show how each hot pattern is served and where the hard parts are. That usually means entities, keys, a few fields, stores and one or two notes on denormalisation or counters. It rarely means data types, every column or normal forms. If you find yourself spending more than five or six minutes on the data model in a forty five minute round, ask whether the detail is changing any decision. If not, summarise and move on.

Connecting to the high level design

The data model and the high level design are tightly linked. Each store in the data model appears as a component in the architecture. Each denormalised copy implies a process that keeps it updated, such as a fan out worker or a change data capture stream. Each partitioned store implies routing. When you draw the architecture, point back at the data model: the feed service reads from the feed table we keyed by user; the fan out worker writes to it when a post is created. That continuity makes the design feel coherent.

Connecting to the deep dives

Many of the best deep dive topics live in the data model. How does the feed handle celebrity accounts? How do we prevent overselling in a flash sale? How do we avoid hot partitions in large group chats? How do we keep the search index in sync with the database? When you finish the data model, it is often worth naming one such question: the trickiest part of this model is the fan out for accounts with millions of followers; I would like to come back to that. It gives the interviewer an easy way to choose a deep dive and shows you know where the difficulty lies.

Evolving the model

Designs change during the interview. The interviewer adds a requirement, such as users can edit posts, or changes a number, such as ten times more writes. Return to the data model and update it explicitly. Edits mean we either update the post in place and the feed copies asynchronously, or store versions; I will update in place and keep a short edit history. Ten times the writes means posts now need partitioning by author. Updating the model on the board, rather than only in words, keeps the design consistent and gives the interviewer a clear record of the change.

A sample walkthrough

Interview Dialogue

CandidateHere is the data. Users and posts in a relational database, posts keyed by ID with an index on author and time for profile pages. Follows stored twice, keyed by follower and by followee, because both directions are read. The feed is a wide column table, partitioned by user, sorted by time, holding post ID and a copy of the author's name and avatar.
InterviewerClick to reveal answer
CandidateThe feed is read thousands of times a second, and joining to users for every item would multiply the reads. Names change rarely, so a background job updates copies when someone renames, and the feed may show the old name for a minute.
InterviewerClick to reveal answer
CandidateOne record per user per post, so liking twice does nothing. The count shown is a batched counter updated every few seconds, so a viral post does not hammer one row.
Show all answers

The walkthrough took about two minutes and covered stores, keys, a denormalisation with its trade off and a counter strategy.

A checklist before moving on

Before leaving the data model, check a few things. Does every hot access pattern have a key that serves it in one lookup or a short scan? Does every entity have a store with a reason? Is every partitioned store's key checked for hot spots? Is every denormalised copy paired with a way to update it? Does every entity with strict correctness needs sit in a store that supports the necessary transactions? If the answers are yes, the data model will hold up through the rest of the interview.

Practising the step

Practise data modelling separately from full mock interviews. Take a prompt, list the access patterns in two minutes, then write the model in three. Check it against the checklist above. Over several prompts, you will see the same shapes recurring: a per user feed keyed by user and time, a per conversation log keyed by conversation and time, edges stored both ways, counters batched, media in object storage, correctness data in relational tables. Once these shapes are familiar, you will recognise which ones a new prompt needs within a minute of reading it.

Adapting to the interviewer

Some interviewers want to see a detailed schema; others are happy with three lines. Watch for signals. If the interviewer asks about column types or indexes, they want more detail, and you should give it for the entities they ask about. If they nod and look at the clock, summarise and move on. If they ask about a specific entity, such as how inventory is stored, that entity is probably the deep dive, and you should go into it carefully. Adapting the depth to the interviewer's interest is itself part of the evaluation.

Common follow up questions

A few follow up questions come up again and again, and it helps to have a short answer ready. How do you generate IDs without a central counter? Time ordered IDs with a machine component. How do you avoid a hot partition for a celebrity or a huge group? Split the key into buckets, cache the hot reads and handle the largest entities on a separate path. How do the search index and the database stay in sync? Change data capture or an outbox, with retries. What happens when a partition fills up? Split it and rebalance, which is why consistent hashing or range splitting is used. How long is data kept? Hot data for a period, then moved to cheaper storage, with deletion rules for privacy. Each answer is a sentence or two, and each one shows the interviewer that the data model has been thought through beyond the first pass.

The data model as the backbone

Of all the board sections, the data model is the one most often referred to later in the interview. Every deep dive, every failure scenario and every change in requirements touches it. Keeping it short, keyed and up to date gives the rest of the session a reliable backbone, and it gives the interviewer a clear picture of what was decided and why, which is exactly what they will need when they write their feedback.

Name the trickiest part

End the data model by naming its hardest part, such as fan out for celebrity accounts or contention on a flash sale item. It shows you know where the difficulty lies and offers the interviewer a natural deep dive.