The correct choice is to create a secondary index on both Orders.CustomerID and Customers.CustomerID, because this enables Cloud Spanner to perform an index-based join that avoids scanning the full base tables. By leveraging distributed, strongly consistent secondary indexes, Spanner can directly locate matching rows across both tables, dramatically reducing latency and resource consumption compared to a broadcast join or full table scan. On the Google Professional Cloud Developer exam, this scenario tests your understanding of how Spanner’s indexing architecture differs from traditional relational databases—specifically, that secondary indexes are essential for efficient join performance at scale, as Spanner does not automatically create indexes on foreign keys. A common trap is assuming a single index on one table is sufficient, but Spanner requires indexes on both join columns to avoid a costly table scan on the unindexed side. Memory tip: “Index both sides of the join to avoid the full-table grind.”
PCD Practice Question: Designing highly scalable, available, and reliable cloud-native applications
This PCD practice question tests your understanding of designing highly scalable, available, and reliable cloud-native applications. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Refer to the exhibit.
```sql
SELECT * FROM Orders JOIN Customers ON Orders.CustomerID = Customers.CustomerID
WHERE Customers.City = 'Tokyo' AND Orders.OrderDate > '2023-01-01';
```
This query is running slowly on a large Cloud Spanner database.
Refer to the exhibit. Which schema or index change would most improve this query?
Refer to the exhibit.
```sql
SELECT * FROM Orders JOIN Customers ON Orders.CustomerID = Customers.CustomerID
WHERE Customers.City = 'Tokyo' AND Orders.OrderDate > '2023-01-01';
```
This query is running slowly on a large Cloud Spanner database.
A
Create a primary key on CustomerID
Why wrong: Primary keys already exist and are not on these columns; creating a new primary key would change the table structure.
B
Rewrite the query as a subquery
Why wrong: Rewriting does not change the access pattern and likely does not improve performance.
C
Create a secondary index on Orders.CustomerID and Customers.CustomerID
Secondary indexes speed up joins by enabling index seeks instead of full scans.
D
Increase the number of Spanner nodes
Why wrong: More nodes improve throughput but do not reduce the cost of full table scans.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a secondary index on Orders.CustomerID and Customers.CustomerID
Option C is correct because creating secondary indexes on both `Orders.CustomerID` and `Customers.CustomerID` allows Spanner to perform an index-based join without scanning the full base tables. Spanner uses distributed, strongly consistent secondary indexes to avoid full table scans, which dramatically reduces latency and resource consumption for join queries. Without these indexes, Spanner must perform a broadcast join or a full table scan on both tables, which is inefficient at scale.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
Create a primary key on CustomerID
Why it's wrong here
Primary keys already exist and are not on these columns; creating a new primary key would change the table structure.
✗
Rewrite the query as a subquery
Why it's wrong here
Rewriting does not change the access pattern and likely does not improve performance.
✓
Create a secondary index on Orders.CustomerID and Customers.CustomerID
Why this is correct
Secondary indexes speed up joins by enabling index seeks instead of full scans.
Related concept
Read the scenario before looking for a memorised answer.
✗
Increase the number of Spanner nodes
Why it's wrong here
More nodes improve throughput but do not reduce the cost of full table scans.
Common exam traps
Common exam trap: answer the scenario, not the keyword
Cisco often tests the misconception that adding nodes or rewriting queries can fix performance issues, when the real bottleneck is the lack of appropriate secondary indexes for join and filter operations in a distributed database like Spanner.
Detailed technical explanation
How to think about this question
Spanner uses a distributed, Paxos-based storage engine where secondary indexes are stored as separate tables that are automatically maintained and strongly consistent. When a query joins on `CustomerID`, Spanner's query optimizer can choose an index join plan that reads only the indexed columns from both tables, reducing the number of splits accessed and minimizing cross-node communication. In real-world scenarios, a missing secondary index on a join column can cause Spanner to fall back to a broadcast join, which reads all rows from one table and sends them to all nodes processing the other table, leading to high network overhead and poor performance.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
An e-commerce site experiences heavy traffic on Black Friday and near-zero traffic during off-peak weeks. Rather than provisioning permanent large VMs, the team uses auto-scaling groups that add capacity automatically under load and reduce it overnight. Questions like this test whether you understand elasticity, availability zones, and cloud compute scaling patterns.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Designing highly scalable, available, and reliable cloud-native applications — This question tests Designing highly scalable, available, and reliable cloud-native applications — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Create a secondary index on Orders.CustomerID and Customers.CustomerID — Option C is correct because creating secondary indexes on both `Orders.CustomerID` and `Customers.CustomerID` allows Spanner to perform an index-based join without scanning the full base tables. Spanner uses distributed, strongly consistent secondary indexes to avoid full table scans, which dramatically reduces latency and resource consumption for join queries. Without these indexes, Spanner must perform a broadcast join or a full table scan on both tables, which is inefficient at scale.
What should I do if I get this PCD question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This PCD 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 PCD exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.