Skip to the guide

Data modelling from access patterns

IntermediateConcept3 pages

The tables you draw in an interview should come from the queries the product makes, not from the nouns in the prompt. This guide is the method: list the access patterns with their rates, choose keys so each hot query is one cheap read, then check that no partition grows too big or too busy.

Arranging a kitchen

When you move into a new flat, you could put things away by type: metal here, glass there. Or you think about what you actually do. You make tea six times a day, so the kettle, mugs and tea bags go together by the sink. The roasting tin you use twice a year goes on the top shelf. And if you also drink tea at your desk, you keep a second set of mugs there rather than walking to the kitchen each time.

  • what you do in the kitchen → access patterns: the queries the app runs, and how often
  • tea things together → keys chosen so a hot query reads one place
  • the top shelf → rare queries may be slow: a scan, a batch job, an analytics copy
  • the mugs on your desk → a second copy of the data, arranged for another query