
Answer-first summary for fast verification
Answer: Generate a random universally unique identifier number (version 4 UUID) as the primary key
using a random UUID as the primary key in Cloud Spanner helps avoid hotspotting issues that can occur with monotonically increasing keys such as timestamps or sequential IDs. This approach distributes inserts evenly across partitions, improving scalability and performance.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
When designing a new transaction table in Cloud Spanner for storing product sales data, which primary key strategy would you recommend for optimal performance?
A
Generate a random universally unique identifier number (version 4 UUID) as the primary key
B
Use the current epoch time as the primary key
C
Concatenate the product name and the current epoch time as the primary key
D
Use the original order identification number from the sales system, which is a monotonically increasing integer, as the primary key
No comments yet.