Professional Cloud Developer · Free Practice Question Medium

Question 16

An ecommerce application is being developed which stores customer, order, and inventory data as relational tables in Cloud Spanner. However, during a load test, it was discovered that the performance of Spanner is not scaling linearly as expected.


What is the reason behind the following?

  • A The use of 64-bit numeric types for 32-bit numbers.
  • B The use of the STRING data type for arbitrary-precision values.
  • C The use of Version 1 UUIDs as primary keys that increase monotonically.
  • D The use of LIKE instead of STARTS_WITH keyword for parameterized SQL queries.
Reveal correct answer

Correct answer: C

Explanation

The use of Version 1 UUIDs as primary keys that increase monotonically is the cause of Spanner performance not scaling linearly as expected, as mentioned in the Professional Google Cloud Developer documentation. This is due to the fact that Spanner uses a distributed architecture that relies on sharding data across many nodes, and when using monotonically increasing primary keys, it can lead to hotspotting on a single node, resulting in uneven distribution of data and performance issues. As stated in the documentation, ""choosing a primary key that is not monotonically increasing can help avoid hotspots and improve write performance."" Therefore, it is recommended to carefully consider the choice of primary key when designing a schema for a Spanner database.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need