Courseiva
Storing the Data →hardMultiple Choice

PDE Storing the Data Practice Question

You are designing a row key for Cloud Bigtable to store user activity logs. Each log entry has a timestamp (millisecond precision) and a user ID. There will be millions of writes per second from many users. To avoid hotspotting, which row key design is BEST?

⚠ Common exam trap

Google PDE often tests the misconception that placing the most selective or unique field first (like timestamp) is best for queries, but in Bigtable the row key design must prioritize write distribution over read optimization to avoid hotspotting.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

hash(userID)#userID#timestamp_millis

Best because it uses a hash of the user ID as the row key prefix, which distributes writes across all Bigtable nodes and avoids hotspotting. Appending the user ID and timestamp ensures uniqueness and supports efficient queries for a specific user's logs. This design prevents the sequential timestamp from creating a single hot node, which is critical for handling millions of writes per second.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    timestamp_millis#hash(userID)

    Why it's wrong here

    Hashing the user ID does not help when the timestamp leads: keys still sort by time, so concurrent writes cluster into one tablet. The hash only spreads keys sharing an identical millisecond. This design suits read patterns scoped to a single user, not high-volume multi-user write distribution.

  • ✗

    timestamp_millis#userID

    Why it's wrong here

    Leading with the timestamp puts every concurrent write into the same narrow key range, so all traffic hits one tablet server — exactly the hotspotting the stem forbids. Timestamp-first keys suit single-source, sequential ingestion, not millions of writes per second spread across many users.

  • ✗

    userID#timestamp_millis

    Why it's wrong here

    Putting userID first spreads writes across many tablets, but it is not the best answer here because the stem's access pattern is time-ordered activity logs; userID-first scatters a single user's entries, hurting range scans by time. It would be correct if queries were per-user rather than chronological.

  • ✓

    hash(userID)#userID#timestamp_millis

    Why this is correct

    Hashing the userID spreads writes uniformly across row ranges, preventing hotspotting from sequential or timestamp-prefixed keys. Appending userID and timestamp preserves per-user chronological ordering while the hash prefix distributes millions of writes per second evenly across tablets.

About these practice questions

This PDE question is part of Courseiva's 747-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PDE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PDE exam.