Design innovative, scalable, and highly available cloud database solutions →easyMultiple ChoiceObjective-mapped
PCDE Practice Question: Design innovative, scalable, and highly available cloud database solutions
You are designing a Spanner schema for a global social media application that stores user posts. Each user can have millions of posts. The most common query is 'get the most recent 10 posts for a user'. Which table interleaving design minimizes latency?
⚠ Common exam trap
Google Cloud often tests the misconception that a secondary index or composite primary key alone provides the same performance as interleaving, but they fail to guarantee physical co-location, which is critical for minimizing latency in globally distributed databases.
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
✓
Interleave the Posts table under the Users table, with user_id as parent key and post_timestamp as the child ordering key.
Interleaving the Posts table under the Users table in Spanner ensures that all posts for a given user are stored in the same split, co-located on the same tablet server. This allows the query for the most recent 10 posts to be served with a single, local range scan on the interleaved child table, using post_timestamp as the descending ordering key, minimizing cross-node communication and latency.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Interleave the Posts table under the Users table, with user_id as parent key and post_timestamp as the child ordering key.
Why this is correct
Interleaving ensures all posts of a user are stored together, enabling fast retrieval.
- ✗
Use a secondary index on user_id in the Posts table.
Why it's wrong here
Index lookups involve an extra hop and may not be co-located, increasing latency.
- ✗
Create a single table with user_id and post_timestamp as a composite primary key.
Why it's wrong here
Without interleaving, rows may be distributed across nodes, causing higher latency.
- ✗
Store posts in a separate Cloud Bigtable table and use the user_id as part of the row key.
Why it's wrong here
This adds cross-service latency and complexity.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCDE question from scratch — 1,446 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.