Access patterns & denormalization
Ledger's chat moved to a key-based store. List the questions first, key the data so each one is a single read, and copy what every read needs — then pay for each copy on every change. When is the copy worth it?
13 minMediumStation: Access patterns & denormalizationMembers lesson
Membership isn’t open yet. The free lessons are open — 16 of them.
- Chat pages openedUsers
- Messages sentUsers
- Author names fetchedUsers
- Ledger chat APIWeb API
- Ledger names APIWeb API
- Ledger chat store (pool of 17)Database
What you'll be able to do
- 1Choose a partition key and sort key that turn each listed access pattern into a single lookup or range read.
- 2Predict how many writes and how much extra storage a denormalized design costs when one shared fact changes.
- 3Choose whether to embed related data, copy part of it, or keep a reference, from how often it is read, how often it changes and whether it grows without bound.
Inside the lesson
- steps
- 12
- questions
- 11
- simulations
- 4
You guess first, then run the system and see if you were right.
Step 1 · The setup
Ledger's group chat now lives in its own key-based store. The team kept the expenses habit: each message holds its author's member id, and the display names live once, in a members table.
The store has no joins. So a chat page reads the group's latest messages in one range read, then fetches each author's name — about 4 lookups a page. Watch 300 chat pages a second, with 30 messages sent alongside.
Steps 2–12 are for members