Why does single-table design in DynamoDB often use composite keys with prefixes like 'USER#' or 'ORDER#'?
hard🧠 Conceptual Q10 of 15
DynamoDB - Access Patterns and Query Optimization
Why does single-table design in DynamoDB often use composite keys with prefixes like 'USER#' or 'ORDER#'?
ATo store binary data in keys
BTo increase table size and complexity
CTo make partition keys optional
DTo avoid key collisions and enable efficient queries across entity types
Step-by-Step Solution
Solution:
Step 1: Understand key prefix purpose
Prefixes distinguish entity types in the same table, preventing key collisions.
Step 2: Evaluate options
To avoid key collisions and enable efficient queries across entity types correctly explains the reason. To increase table size and complexity is false; prefixes simplify queries. To make partition keys optional is incorrect; partition keys are required. To store binary data in keys is unrelated.
Final Answer:
To avoid key collisions and enable efficient queries across entity types -> Option D
Quick Check:
Prefixes prevent collisions = A [OK]
Quick Trick:Prefixes in keys separate entity types clearly [OK]
Common Mistakes:
MISTAKES
Thinking prefixes increase complexity negatively
Believing partition keys can be optional
Misunderstanding key data types
Master "Access Patterns and Query Optimization" in DynamoDB
9 interactive learning modes - each teaches the same concept differently