Bird
0
0

You need to design a DynamoDB table to store IoT sensor data from thousands of devices sending data every second. Which partition key design best ensures even data distribution?

hard🚀 Application Q8 of 15
DynamoDB - Access Patterns and Query Optimization
You need to design a DynamoDB table to store IoT sensor data from thousands of devices sending data every second. Which partition key design best ensures even data distribution?
AUse only the timestamp as the partition key.
BUse a composite partition key combining DeviceId and a truncated timestamp to the minute.
CUse a static value like 'SensorData' as the partition key.
DUse DeviceId alone as the partition key.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze data volume and key uniqueness needs

    Thousands of devices sending data every second require many unique keys to avoid hotspots.
  2. Step 2: Evaluate partition key options

    Composite key with DeviceId and timestamp truncated to minute creates many unique keys spreading load.
  3. Step 3: Reject poor options

    DeviceId alone clusters data per device; static key causes hotspot; timestamp alone groups by time only.
  4. Final Answer:

    Use a composite partition key combining DeviceId and a truncated timestamp to the minute. -> Option B
  5. Quick Check:

    Composite keys with device and time spread load well [OK]
Quick Trick: Combine device ID and time for unique partition keys [OK]
Common Mistakes:
MISTAKES
  • Using static keys causing hotspots
  • Using only timestamp causing clustering
  • Ignoring high write volume impact

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes