Data

DynamoDB single-table design: when and how to use it

A practical introduction to DynamoDB single-table design: access patterns first, key design, GSIs, overloading, and when multiple tables are the better choice.

  • 4 min read
  • Updated December 2, 2026

Amazon DynamoDB gives consistent, low-latency performance at any scale — but only if you model data around how you read it. Single-table design is the best-known technique for doing that, and also one of the most over-applied. This guide explains how it works, when it is the right call, and when several tables are simpler.

Start from access patterns, not entities

In a relational database you normalize entities first and write queries later; the query planner joins whatever you need. DynamoDB has no joins and no query planner. Every efficient read is a GetItem by key or a Query on one partition key with an optional sort key condition. Anything else is a Scan, which reads the whole table.

So modeling starts by listing access patterns: every way the application reads and writes data, with expected volume. For an order-management service that might be:

  1. Get a customer by id.
  2. List a customer's orders, newest first.
  3. Get an order with its line items.
  4. List orders by status for the operations dashboard.
  5. Get a product by SKU.

Only once that list exists do keys make sense.

Keys: partition key and sort key

Each item has a partition key (PK) and usually a sort key (SK). Items with the same PK form an item collection, stored together and sorted by SK. A single Query can return a whole collection or a range of it — which is how DynamoDB "joins": by storing related items in the same collection.

What "single table" means

Single-table design stores several entity types in one table, using generic key attribute names (PK, SK) and prefixed values so different entities can share a collection:

  • Customer: PK = CUSTOMER#c1, SK = PROFILE
  • Order (in the customer's collection): PK = CUSTOMER#c1, SK = ORDER#2026-12-01#o9
  • Order header: PK = ORDER#o9, SK = HEADER
  • Line item: PK = ORDER#o9, SK = ITEM#001
  • Product: PK = PRODUCT#sku-42, SK = PRODUCT

With that layout:

  • "Get customer" is GetItem(CUSTOMER#c1, PROFILE).
  • "List a customer's orders, newest first" is Query(PK = CUSTOMER#c1, SK begins_with ORDER#) in descending order — the date in the sort key gives the ordering for free.
  • "Get an order with its line items" is one Query(PK = ORDER#o9) returning the header and every item.

One request per screen, no joins, predictable latency.

Global secondary indexes

Access pattern 4 — orders by status — doesn't fit the base table's keys. A global secondary index (GSI) re-keys the same items under different attributes. Give order items GSI1PK = STATUS#shipped and GSI1SK = 2026-12-01#o9, and a Query on the GSI lists shipped orders by date.

Things to know about GSIs:

  • They are eventually consistent with the base table.
  • Every write to an indexed item also writes to the index, so each GSI adds write cost.
  • Index overloading — reusing GSI1PK/GSI1SK for different entity types with different meanings — lets a single index serve several access patterns.
  • A sparse index only contains items that have the index attributes, which is a cheap way to index "only open orders" or "only flagged users".

When single-table design is the right choice

Single-table design pays off when:

  • One service owns several related entities that are frequently read together.
  • Latency matters and you want one request per screen.
  • You have a stable, well-understood set of access patterns.

It also keeps operations simple: one table to back up, monitor, and configure.

When multiple tables are better

Single-table design is not a rule. Separate tables are often simpler when:

  • Entities are owned by different services. Each microservice should own its data; sharing one table across services couples their deployments and permissions. (A shared table with strict per-service key prefixes and IAM dynamodb:LeadingKeys conditions can work, but it is a deliberate trade-off.)
  • Entities are never read together. If nothing queries across them, a shared collection gains nothing.
  • Access patterns are still changing fast. Early in a product, a straightforward model can be easier to evolve.
  • Different entities need different settings — capacity mode, streams, TTL, or backup policies.
  • You need analytics. Neither design is good for ad-hoc analytical queries; export to S3 and use Athena, or stream changes to an analytics store.

Practical rules

  • Keep partition keys high-cardinality. Each partition supports up to 3,000 read and 1,000 write capacity units per second; a key everyone writes to (a global counter, "today's date") becomes a hot partition.
  • Keep items small. The item limit is 400 KB, and read and write costs scale with size. Store large blobs in S3 and keep a reference.
  • Store type and version attributes. An entityType attribute and a schema version make migrations and debugging much easier.
  • Use TTL for data that expires — sessions, idempotency keys, temporary state — instead of deleting it with code.
  • Use conditional writes to enforce uniqueness and avoid lost updates.
  • Centralize key construction in a small repository module so prefixes are never hand-typed in handlers.

Capacity modes

  • On-demand: pay per request, no capacity planning, best for unknown or spiky traffic.
  • Provisioned with auto scaling: cheaper for steady, predictable traffic; requires monitoring for throttling.

You can switch between them, with some limits on how often.

Evolving the model

New access patterns will appear. Common, safe ways to support them:

  1. Add a new GSI over existing attributes.
  2. Add new attributes to items, backfill them with a script or a Step Functions Distributed Map job, then add the index.
  3. For larger changes, write to both old and new shapes, backfill, switch reads, and remove the old shape.

Summary

Design from access patterns, use item collections to fetch related data in one request, add GSIs deliberately, and choose single-table design where one service owns related entities that are read together — not as a default for everything.

Our DynamoDB data modeling service validates a model against every access pattern before your code depends on it.

Services

Related services

How we can help you put this guide into practice.

Guides

More guides

Keep reading.

Let's make your serverless workload simpler, safer, and cheaper.

Start with a free 30-minute intro call with a serverless engineer.

Book a consultation