Data Modeling
You normalize into one table per entity because SQL taught you that habit, then
ship a DynamoDB table you cannot query without a full Scan. The migration cost
lands after the product is live.
DynamoDB modeling starts from access patterns: list the reads and writes your feature needs, then design keys and GSIs that serve them. Single-table design packs many entity types into one table when their patterns overlap; it is a trade-off, not a religion. This section teaches both the pattern and the cases where multiple tables are cheaper to build and operate.
What you can do after
- Write down access patterns before keys and map each pattern to a
Queryor a justifiedScan. - Design a single-table layout with entity prefixes, overloaded keys, and sparse GSIs for hot subsets.
- Recognize when separate tables, a cache, or a relational sidecar beat one-table complexity.
- Use a
typeattribute and denormalized fields without breaking idempotent writes.
Reading order
- Single-table design — the mental model: one table, many entity types, keys chosen for co-location.
- How to model data — the worksheet: access patterns in, key design and GSIs out.
- When not single-table — bounded contexts, low overlap, and teams that pay operational tax for one layout.
- Type attribute — discriminating entity kinds in one collection without ambiguous attribute shapes.
- Denormalization — duplicate fields to avoid second hops; know what you give up on updates.
- Singleton items — one row per partition for counters, config, and metadata that must live beside a parent.
Single-table design shines when one Query returns a parent and its children —
for example PK = ORDER#K4 returning header, line items, and shipment events in
sort order. It fails when two services own unrelated domains and every new feature
needs another overloaded GSI. The third guide in this section is the permission
slip to use multiple tables when overlap is thin.
Denormalization duplicates display fields onto parent rows so dashboards do not
need a second hop. The trade-off is write fan-out: changing a customer's display
name might touch every order item that cached it. Singleton items (PK = CONFIG,
SK = APP) hold global counters and feature flags beside tenant data without a
separate config store. Model those explicitly so a Query on a tenant partition
does not accidentally return megabytes of unrelated config.
Try it in DynoTable
Sketch keys before you touch AWS. The free single-table design planner turns a list of access patterns into PK/SK placement, GSI suggestions, example items, and CreateTable JSON. Paste the output into DynoTable and browse how items actually land in collections.
For the pattern your keys do not serve, the SQL Workbench
runs JOIN and aggregates client-side over bounded reads — honest relief, not a
modeling excuse. Paid plans add write staging when you prototype item shapes in
the editor.
Download DynoTable to model and browse these layouts against a live table.