nerdexam
Google

PROFESSIONAL-CLOUD-DATABASE-ENGINEER · Question #128

Your company uses Cloud Spanner for a mission-critical inventory management system that is globally available. You recently loaded stock keeping unit (SKU) and product catalog data from a company…

The correct answer is D. Promote high-cardinality attributes in multi-attribute primary keys. E. Use bit-reverse sequential value as the primary key. Hotspots in Cloud Spanner occur when too many reads or writes concentrate on a narrow key range, overloading a single split server. Option D is correct because promoting high-cardinality attributes (those with many distinct values, such as a UUID or customer ID) as the leading…

Designing and planning database solutions

Question

Your company uses Cloud Spanner for a mission-critical inventory management system that is globally available. You recently loaded stock keeping unit (SKU) and product catalog data from a company acquisition and observed hotspots in the Cloud Spanner database. You want to follow Google-recommended schema design practices to avoid performance degradation. What should you do? (Choose two.)

Options

  • AUse an auto-incrementing value as the primary key.
  • BNormalize the data model.
  • CPromote low-cardinality attributes in multi-attribute primary keys.
  • DPromote high-cardinality attributes in multi-attribute primary keys.
  • EUse bit-reverse sequential value as the primary key.

How the community answered

(30 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    10% (3)
  • D
    83% (25)

Explanation

Hotspots in Cloud Spanner occur when too many reads or writes concentrate on a narrow key range, overloading a single split server. Option D is correct because promoting high-cardinality attributes (those with many distinct values, such as a UUID or customer ID) as the leading component of a composite primary key distributes rows across many different key ranges and therefore across many splits, eliminating hotspots. Option E is correct because a bit-reverse sequential value takes a monotonically increasing integer and reverses its bits, scattering writes across the entire key space instead of always appending to the end of one split. Option A (auto-incrementing keys) is explicitly an anti-pattern for Cloud Spanner because it creates a write hotspot at the highest key value. Option C (low-cardinality attributes) is the opposite of best practice; few distinct values mean rows cluster together. Option B (normalizing the data model) is generally good design but does not directly address split-level hotspots.

Topics

#Cloud Spanner#Schema Design#Primary Keys#Performance Optimization

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DATABASE-ENGINEER Practice