04.3.1 · Skill in Data engineering

Data modeling

Designing the structure of data to fit the domain and its queries.

The data model shapes what the product can do easily. A good model reflects the domain, enforces important rules and supports the main queries. It is one of the hardest things to change later, so it deserves thought upfront.

Your status · Data modeling

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

Why it matters for a product engineer

The data model decides what the product can do easily and what it can barely do at all. A good model reflects the domain, enforces the important rules and supports the main queries. It is one of the hardest things to change later, because data outlives the code that wrote it. So it deserves thought before the first table, and again each time the product’s main question changes.

How to do it

  1. Name the entities in the product’s own words, and the relationships between them: one to one, one to many, many to many.
  2. List the main questions the product must answer, and check that the model answers them without scanning everything.
  3. Give each thing that changes on its own its own table or record. If one change rewrites a large record, the model is too coarse.
  4. Put the important rules in the database: required fields, unique values, foreign keys.
  5. Record where data came from and who may see it, especially if it feeds an AI system.
  6. Expect change. Leave room to add fields and relationships without moving all the data.

Common mistakes

  • Modelling the first screen instead of the domain.
  • A list stored inside another record, so changing one item rewrites the whole record.
  • Free text where the product needs a fixed set of values.
  • No owner for a field, so nobody knows what it means.

Example

At first, each Stripe customer had at most one subscription, stored inside the customer record. When users wanted several subscriptions, it became a list inside the customer. As subscriptions gained trials, coupons and invoices, every change to one subscription rewrote the whole customer. Stripe moved subscriptions into their own table, which meant migrating hundreds of millions of objects without downtime.

Side by side

Three ways Stripe stored subscriptions

Several per customerTo change one
One field in the customerNoRewrite the customer
A list in the customerYesRewrite the customer
Their own tableYesUpdate one record

Each model was right for the product of its time. The cost came from keeping the old shape after the product changed.

ReportedJacqueline Xu, 'Online migrations at scale', Stripe, 2 Feb 2017

Sources: Designing data-intensive applications (Martin Kleppmann) ↗ · Online migrations at scale (Jacqueline Xu, Stripe) ↗

Technical leverage

Represent product entities and relationships explicitly, including document provenance and access boundaries when data feeds an AI system.

Evidence of mastery

Put it into practice
Practice
Model a knowledge-backed product feature and test how updates, deletions and permissions propagate.
Artifact
A schema and sample queries showing traceability from a result to its authorized source.

What good looks like

  • Relationships and integrity constraints match the domain.
  • Source deletion and permission changes reach derived indexes.

Use this evidence to assess your work. Your map status is a self-assessment, not a certification.

Resources

1

Tools

1
Tools for Data engineering