DynamoDB Partition Key — Hot Partitions & Key Design
Reviewed by Gurusankar M. · Updated Aug 24, 2026
Short Answer
DynamoDB distributes data across partitions by the partition key's hash. If many requests target one key (or a low-cardinality key), that partition gets 'hot' — throttling even when total capacity is fine. Choose a high-cardinality, evenly-accessed key; add a suffix/sharding for hot keys.
On this page
Concept Made Simple
Coffee Chat Question
“How does the DynamoDB partition key affect performance, and what is a hot partition?”
Remember It Faster
Mind Map Answer
The partition key (hash key) is the attribute DynamoDB hashes to decide which physical partition stores an item. It's how DynamoDB scales horizontally — every item's partition key hash maps to one of many partitions, so read/write load spreads across the fleet instead of hitting a single server. There's no ad-hoc query flexibility like SQL: you look up by partition key (and optionally a sort key or GSI), so access patterns have to be known before the table is designed.
- Partition key
- hashed → decides the partition
- Hot partition
- skewed access → throttling
- Fix
- high-cardinality key / write sharding
| Partition Key | Sort Key | |
|---|---|---|
| Required? | Always | Optional |
| Determines | Which partition stores the item (hash) | Item order/uniqueness within that partition |
| Query support | Exact match only (=) | Range, begins_with, between |
| Uniqueness | Must be unique alone, unless paired with a sort key | PK + SK together must be unique |
A concrete before/after: a table partitioned by status (3 values — pending/shipped/delivered) versus the same table repartitioned by userId (millions of distinct values).
| Bad key: status (3 values) | Good key: userId (millions of values) | |
|---|---|---|
| Distinct key values | 3 | ~1 per user — millions |
| Where traffic lands | Every request collapses onto one of 3 partitions | Requests spread across many partitions |
| Per-partition ceiling | Hit almost immediately, no matter total provisioned capacity | Each partition stays well under AWS's per-partition throughput ceiling |
| Result at scale | Throttled (ProvisionedThroughputExceededException) even with capacity to spare table-wide | Throughput scales close to linearly with provisioned capacity |
This doesn't mean low-cardinality attributes like status are unusable — they just can't be the partition key. Keep the high-cardinality id (e.g. orderId) as the partition key, and put status in a sort key or a Global Secondary Index instead. You still get an efficient "all orders with status = shipped" query via the GSI, but writes spread across partitions by orderId instead of collapsing onto one of three.
Adaptive capacity helps, but only up to a point. DynamoDB continuously monitors traffic per partition and, when it detects a hot partition, transparently isolates that partition's keys and boosts throughput toward it — instantly for isolated hot keys since 2019, without any table resizing or manual intervention. What it can't do is rescue a pathologically low-cardinality key design: adaptive capacity can boost one hot partition's share of the table's total provisioned throughput, but it can't manufacture throughput the table doesn't have, and a single partition is still bounded by DynamoDB's documented per-partition limits (up to 3,000 read request units and 1,000 write request units per second), so a design that funnels traffic through a handful of key values hits that ceiling however the table is provisioned. Adaptive capacity buys headroom for uneven access on an otherwise reasonable key; it's not a substitute for high-cardinality key design.
You don't calculate or configure the number of partitions — DynamoDB manages it. It places each item by hashing its partition key, and splits partitions automatically as data grows or traffic rises (on-demand tables also adapt to traffic on their own). The figure worth designing around is the per-partition limit above. As a rough back-of-envelope check, peak writes per second ÷ 1,000 and peak reads per second ÷ 3,000 give a lower bound on how many evenly-used partition key values you need in play at once. It's an estimate for judging key spread, not a formula DynamoDB exposes or guarantees.
Time-based keys are the sneaky version of a low-cardinality key — the partition key itself may have plenty of distinct values over the table's lifetime (2026-09-01, 2026-09-02, ...), so it doesn't look low-cardinality at a glance. The problem is access pattern, not key design: almost all reads and writes target today's date, so at any given moment traffic still collapses onto whichever single partition represents "now," while every other date's partition sits idle. The fix is the same write-sharding idea from above, applied proactively: suffix the date with a shard number (2026-09-15#3) so "today" is spread across multiple partitions even while it's the only date anyone's writing to, rather than discovering the hot-partition problem only once a single calendar day's traffic exceeds one partition's throughput ceiling.
Learn by Doing
Hands-on Keyboard
// Write sharding: spread a hot partition key across N logical shards
// so no single physical partition absorbs all the write traffic.
int shardCount = 10;
String hotKey = "sensor-42"; // naturally low-cardinality / bursty
int shard = ThreadLocalRandom.current().nextInt(shardCount);
String shardedPk = hotKey + "#" + shard; // e.g. "sensor-42#7"
PutItemRequest put = PutItemRequest.builder()
.tableName("Readings")
.item(Map.of(
"pk", AttributeValue.fromS(shardedPk), // spread across 10 partitions
"sk", AttributeValue.fromS(Instant.now().toString()),
"value", AttributeValue.fromN(String.valueOf(reading))))
.build();
ddb.putItem(put);
// Reads must now fan out across all shards and merge results client-side —
// that's the cost of sharding: writes get cheap, reads get more complex.
List<QueryRequest> shardQueries = IntStream.range(0, shardCount)
.mapToObj(i -> QueryRequest.builder()
.tableName("Readings")
.keyConditionExpression("pk = :pk")
.expressionAttributeValues(Map.of(":pk", AttributeValue.fromS(hotKey + "#" + i)))
.build())
.toList();10 physical partitions absorb the write load instead of 1; queries fan out and merge.
Think Beyond the Expected
What If?
A table partitioned by 'status' (only 3 values) throttles under load — why and fix?
Only 3 partition-key values means traffic concentrates on 3 partitions → hot partitions and throttling regardless of provisioned capacity. Use a high-cardinality key (e.g. entity id) and put status in a GSI/sort key, or shard the hot key with a suffix.
Real World
Hot-partition throttling from low-cardinality or skewed keys is the #1 DynamoDB performance pitfall; key design (and write sharding for hotspots) is the fix, not raising capacity. The write-sharding pattern above is the standard escape hatch when an attribute is inherently hot (a trending item, a single IoT sensor, a viral post) and can't simply be swapped for a different key.
Interviewer's Expectation
Keywords they're listening for:
- hash-based distribution
- hot partition from skew/low cardinality
- high-cardinality key
- write sharding
- adaptive capacity limits
Common Mistakes
- Low-cardinality partition keys
- Time-based keys causing hot 'current' partition
- Raising capacity to fix skew (doesn't)
Best Practices
- Choose high-cardinality, evenly-accessed keys
- Shard hot keys with a suffix
- Design keys around access patterns
Follow-up Questions
- What is a DynamoDB partition key?
- How does DynamoDB distribute data across partitions?
- What makes a partition key 'high-cardinality', and why does it matter?
- Partition key vs sort key — what's the difference?
- How does adaptive capacity help (and not)?
- How do you shard a hot write key?
References
Continue Learning with AI
Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly — AI is your learning companion, not a shortcut.
Plain-language foundations
I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner. Topic: DynamoDB (AWS) Interview question: "How does the DynamoDB partition key affect performance, and what is a hot partition?" Please: 1. Explain the core idea in simple, plain language, using an everyday analogy. 2. Define any technical terms you use. 3. Walk through one small, concrete example. 4. Finish with a single sentence I can easily remember. Keep the tone friendly and assume I'm new to this topic.
Was this answer helpful?
Affiliate links
Tools for Your Developer Workspace
Equipment for a comfortable, productive setup.
As an Amazon Associate I earn from qualifying purchases.
- MonitorView on Amazon : BenQ EW2790U 27-inch Monitor (opens in a new tab)
BenQ EW2790U 27-inch Monitor
- LaptopView on Amazon : Acer Aspire One Laptop (opens in a new tab)
Acer Aspire One Laptop
- Office ChairView on Amazon : Wakefit Gravita Ergonomic Office Chair (opens in a new tab)
Wakefit Gravita Ergonomic Office Chair