Choose the primary key strategy for a Cloud Spanner transactions table storing product sales data that optimizes write performance and avoids hotspotting.
Choose an answer
Tap an option to check your answer.
Correct answer: A random universally unique identifier (version 4 UUID).
Why this is the answer
A random universally unique identifier (version 4 UUID) is the best choice because its randomness distributes writes evenly across Cloud Spanner's servers, preventing hotspotting and optimizing write performance. Hotspotting occurs when a single server becomes a bottleneck due to an uneven distribution of writes. The current epoch time and a monotonically increasing integer (like the original order identification number) are poor choices because they generate sequentially increasing keys. This directs all new writes to the same server, causing severe hotspotting. A concatenation of the product name and the current epoch time would also likely lead to hotspotting if certain products are sold much more frequently, or if the epoch time component still dominates the key ordering.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed