Courseiva

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

A global gaming company uses Spanner to store player profiles and scores. The most common query is 'Get the top 10 players by score' across all regions. The 'Players' table has millions of rows. Which schema design and query approach provides the best performance?

⚠ Common exam trap

Many candidates mistakenly think that interleaving (Option C) is a universal performance solution, but it actually optimizes for hierarchical joins, not global top-N queries, leading candidates to overlook the simplicity and efficiency of a well-placed secondary index with `ORDER BY` and `LIMIT`.

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

Add a secondary index on score column and query 'SELECT * FROM Players ORDER BY score DESC LIMIT 10'.

A secondary index on the `score` column allows Spanner to perform an index scan in descending order, retrieving only the top 10 rows without scanning the entire `Players` table. The `ORDER BY score DESC LIMIT 10` query leverages the index's sorted structure, making it the most efficient approach for this common query pattern in a globally distributed database.

Answer analysis

Option-by-option breakdown

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

  • Add a generated column storing the score as a string and index it.

    Why it's wrong here

    No benefit; string sorting would not be faster.

  • Use a STORING clause to store additional columns in the index.

    Why it's wrong here

    STORING clause avoids fetching the table, but does not help ordering.

  • Use a parent-child interleaving between a 'Leaderboard' parent table and 'Players' child table.

    Why it's wrong here

    Interleaving does not help with ordering across all rows.

  • Add a secondary index on score column and query 'SELECT * FROM Players ORDER BY score DESC LIMIT 10'.

    Why this is correct

    The index allows the database to find the top 10 without scanning all rows.

About these practice questions

This PCDE question is part of Courseiva's 1,446-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.