Design a scalable SQL schema for global ecommerce. Store all customer transactions and ensure CustomerId and TransactionId are unique. Which database and key strategy should you use?
Choose an answer
Tap an option to check your answer.
Correct answer: Use Cloud Spanner with TransactionId and CustomerId as composite primary keys, using a random UUID for TransactionId..
Why this is the answer
Cloud Spanner is the best choice for a globally scalable SQL database, offering strong consistency and high availability across regions, which is crucial for global e-commerce transactions. Using TransactionId and CustomerId as a composite primary key ensures uniqueness for each transaction within a customer's history. A random UUID for TransactionId prevents hotspotting, a common issue in distributed databases when sequential keys are used, as new writes would all target the same range of keys. Cloud SQL, while a managed relational database, is not designed for global, planet-scale transactional consistency and horizontal scalability in the same way Cloud Spanner is. Incremental numeric TransactionIds would lead to hotspotting in a distributed database like Spanner, as all new transactions would append to the same logical key range, causing contention.
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