Bird
0
0

You need to design a Bigtable schema to store IoT sensor data with frequent writes and queries by device and time range. Which row key design is best?

hard📝 Application Q8 of 15
GCP - Cloud Firestore and Bigtable
You need to design a Bigtable schema to store IoT sensor data with frequent writes and queries by device and time range. Which row key design is best?
A<code>timestamp#deviceID</code> for natural time ordering
B<code>deviceID#reverseTimestamp</code> to avoid hotspots and enable time range scans
C<code>deviceID#timestamp</code> for simple ordering
D<code>randomUUID</code> for even distribution
Step-by-Step Solution
Solution:
  1. Step 1: Consider write hotspots

    Using timestamp prefix causes hotspots; reversing timestamp avoids this.
  2. Step 2: Support time range queries

    DeviceID prefix groups data by device; reverse timestamp orders recent data first.
  3. Final Answer:

    deviceID#reverseTimestamp to avoid hotspots and enable time range scans -> Option B
  4. Quick Check:

    Reverse timestamp + deviceID prefix = A [OK]
Quick Trick: Use reverse timestamps to prevent hotspots [OK]
Common Mistakes:
  • Using timestamp prefix causing hotspots
  • Ignoring query patterns
  • Choosing random keys losing query efficiency

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes