Design a DynamoDB single-table schema and avoid hot partition problems under high throughput

domain: aws-dynamodb · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Identify all access patterns before designing the table; DynamoDB requires you to model around queries, not around entities — map each access pattern to a primary key (PK) and sort key (SK) combination, using prefixes like USER#<id> or ORDER#<id> to namespace item types
  2. Use sparse Global Secondary Indexes (GSIs) for additional access patterns: only project the attributes you query, and only write the GSI keys on items that actually need that index to keep GSI size and cost minimal
  3. Distribute writes across many partition key values — avoid keys like a static status code, date-only strings, or sequential IDs that funnel traffic to a small number of partitions; add a random suffix or shard number to high-cardinality hot keys
  4. For known high-traffic partitions (e.g., a celebrity user), use write sharding: append a random integer (0–N) to the PK at write time and read from all N shards with parallel queries or a scatter-gather pattern
  5. Enable DynamoDB auto-scaling or use on-demand capacity mode for unpredictable workloads; set separate read and write capacity targets and watch the ConsumedWriteCapacityUnits and ThrottledRequests CloudWatch metrics
  6. Use condition expressions (ConditionExpression) and transactional writes (TransactWriteItems, max 100 items) to enforce consistency without application-level locking

Known gotchas

Related routes

Implement DynamoDB GSI overloading with sparse indexes to support multiple access patterns on a single-table design
docs.aws.amazon.com/amazondynamodb/latest/developerguide · 6 steps · unrated
Backfill a DynamoDB Global Secondary Index and manage on-demand capacity during creation
aws-dynamodb · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans