Google Cloud Professional Data Engineer — Question 332

You need to create a new transaction table in Cloud Spanner that stores product sales data. You are deciding what to use as a primary key. From a performance perspective, which strategy should you choose?

Answer options

Correct answer: C

Explanation

Using a random universally unique identifier number (version 4 UUID) as a primary key helps to distribute writes evenly across the database, which enhances performance. In contrast, the current epoch time and a concatenation with product name can lead to clustering of writes, while a monotonically increasing integer may cause hot-spotting, leading to performance bottlenecks.