nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #1

You are designing a schema for a table that will be moved from MySQL to Cloud Bigtable. The MySQL table is as follows: How should you design a row key for Cloud Bigtable for this table?

The correct answer is B. Set Account_id_Event_timestamp as a key.. In Cloud Bigtable, the row key is the only indexed field and determines both data distribution and query performance. Using Account_id#Event_timestamp as a composite key is the best design for this table because it groups all events for a given account together (enabling efficien

Designing Bigtable schemas

Question

You are designing a schema for a table that will be moved from MySQL to Cloud Bigtable. The MySQL table is as follows:

How should you design a row key for Cloud Bigtable for this table?

Exhibit

PROFESSIONAL-CLOUD-DEVELOPER question #1 exhibit

Options

  • ASet Account_id as a key.
  • BSet Account_id_Event_timestamp as a key.
  • CSet Event_timestamp_Account_id as a key.
  • DSet Event_timestamp as a key.

How the community answered

(25 responses)
  • A
    8% (2)
  • B
    72% (18)
  • C
    4% (1)
  • D
    16% (4)

Explanation

In Cloud Bigtable, the row key is the only indexed field and determines both data distribution and query performance. Using Account_id#Event_timestamp as a composite key is the best design for this table because it groups all events for a given account together (enabling efficient range scans per account) while the appended timestamp makes each row unique and allows time-ordered retrieval within an account. Option A (Account_id alone) would cause row key collisions when multiple events exist for the same account. Option C (Event_timestamp#Account_id) is an anti-pattern because it leads to 'hotspotting' - all writes go to a single tablet region corresponding to the most recent timestamp, creating a performance bottleneck. Option D (Event_timestamp alone) also causes hotspotting and doesn't uniquely identify rows.

Topics

#Cloud Bigtable#Row Key Design#Schema Design#NoSQL Databases

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice