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
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
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)- A8% (2)
- B72% (18)
- C4% (1)
- D16% (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
Community Discussion
No community discussion yet for this question.
