RDS vs DynamoDB
AWS for Interviews: lesson 6 of 18
Flexible SQL, or key lookups at any scale — if the keys spread.
Lesson 6 of 18 · 7 min
RDS vs DynamoDB
Step 1 of 10
Every DynamoDB item has a partition key. Three customers are about to write orders.
The Idea
RDS runs managed relational engines — MySQL, PostgreSQL, MariaDB, Oracle, SQL Server, Db2 — for joins, transactions and ad-hoc SQL. Multi-AZ keeps a synchronous standby for failover; asynchronous read replicas scale reads. DynamoDB is key-value: the partition key is hashed to choose a partition, and an optional sort key orders items under one key.
Real-World Example
An orders table keyed by customer ID, sorted by order date, makes "this customer's orders, newest first" one Query. Key every flash-sale write by the sale ID instead, and all traffic lands on one hot partition; a key suffix (write sharding) spreads it.
The Tradeoff
Each partition tops out at 3,000 read units and 1,000 write units per second (as of September 2026), so a hot key throttles while the table has room. DynamoDB wants access patterns known up front; RDS forgives a query nobody planned.
Hands-On
# illustrative — needs AWS credentials and an "orders" table
# (partition key customer_id, sort key order_ts)
import boto3
from boto3.dynamodb.conditions import Key
table = boto3.resource("dynamodb").Table("orders")
table.put_item(Item={"customer_id": "c#42", "order_ts": "2026-09-28T10:00", "total": 30})
resp = table.query(
KeyConditionExpression=Key("customer_id").eq("c#42"),
ScanIndexForward=False, # newest first
)
Your turn
Put the steps in the right order.
- Append a suffix 1..N to the key so writes hash to different partitions
- Notice every write in the sale uses one partition key value
- Read the sale back by querying each suffix and merging
- See one partition throttle while the table has spare capacity
Mini quiz
1 / 3
DynamoDB decides which partition stores an item by:
Sources
- Core components of Amazon DynamoDB — DynamoDB Developer Guide
- Best practices for designing partition keys — DynamoDB Developer Guide
- Using write sharding to distribute workloads evenly — DynamoDB Developer Guide
- Multi-AZ DB instance deployments — Amazon RDS User Guide