Courseiva

PCDE Practice Question: Design innovative, scalable, and highly available cloud database solutions

You are designing a Spanner schema for a global inventory system. The table Products has primary key (ProductId STRING). The table Inventory has primary key (ProductId STRING, WarehouseId INT64) and is interleaved in Products. You expect high write throughput on Inventory. Which TWO design choices will help avoid hotspots?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use UUID for ProductId

To avoid hotspots in Spanner, avoid monotonically increasing keys. ProductId should be a UUID or hash. Also, using a hash prefix on ProductId as the first part of the key can help distribute writes. Interleaving is fine. Secondary indexes with STORING are for reads. Reverse timestamps are for Bigtable. The correct choices are using UUID and adding a hash prefix.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use UUID for ProductId

    Why this is correct

    UUIDs are random and help distribute writes.

  • Use a hash prefix of ProductId as the first key part in Inventory

    Why this is correct

    Hash prefix distributes writes across tablets.

  • Reverse the timestamp in the row key

    Why it's wrong here

    Reversing timestamp is a Bigtable technique, not applicable to Spanner.

  • Use a monotonically increasing sequence for ProductId

    Why it's wrong here

    Monotonically increasing keys cause hotspots.

  • Create a secondary index on WarehouseId with STORING

    Why it's wrong here

    Secondary indexes do not affect write distribution of the primary table.

About these practice questions

One of 1,446 original PCDE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCDE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCDE exam.