AWS Cloud Architecture•Part 4: Storage, Content Delivery & Databases (36 - 50)
DynamoDB Single-Table Design.
In Simple Words:
Consolidates multiple entities (Users, Orders, Items) into a single DynamoDB table using generic Partition Keys (PK) and Sort Keys (SK) (e.g., PK=USER#123, SK=ORDER#999). Fetches a user and all their recent orders in a single sub-10ms query!
typescript
// Single table query: Fetch user and all their orders in ONE request:
const params = {
TableName: "EcommerceTable",
KeyConditionExpression: "PK = :pk AND SK begins_with(:prefix)",
ExpressionAttributeValues: {
":pk": "USER#1001",
":prefix": "ORDER#"
}
};