Manage a solution that can span multiple database technologies →mediumMultiple ChoiceObjective-mapped
PCDE Practice Question: Manage a solution that can span multiple database technologies
A company uses Cloud Spanner for a global inventory application. They need to add a new index to a large table without downtime. What is the recommended approach?
⚠ Common exam trap
The PCDOE exam often tests the misconception that Cloud Spanner requires special syntax or flags (like ONLINE or --async) to achieve non-blocking DDL, when in fact all DDL operations in Spanner are designed to be non-blocking by default.
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 CREATE INDEX; Spanner handles it as a non-blocking operation
Cloud Spanner's CREATE INDEX operation is inherently non-blocking; it performs the index backfill as a background process without locking the table or blocking reads and writes. This allows the index to be added to a large table with zero downtime, as Spanner manages the consistency and availability of the data throughout the operation.
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 the index using ALTER TABLE with 'ONLINE' clause
Why it's wrong here
The correct syntax is CREATE INDEX; ALTER TABLE is for schema changes but not for index creation.
- ✗
Use gcloud spanner databases ddl update with --async flag
Why it's wrong here
The async flag does not avoid blocking; schema changes like CREATE INDEX are already non-blocking.
- ✗
Take a backup, create index on a new instance, and switch traffic
Why it's wrong here
This is cumbersome and unnecessary; Spanner supports online index creation.
- ✓
Use CREATE INDEX; Spanner handles it as a non-blocking operation
Why this is correct
Spanner perform index creation as a background operation that does not block writes.
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 →
Same concept, more angles
1 more way this is tested on PCDE
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. You are responsible for a Cloud Spanner instance that serves a global user base. A new feature requires adding an index on a column of an existing table that contains millions of rows. The table is actively used by production traffic. What is the recommended approach to add the index with minimal impact?
hard- A.Create a second table with the index already defined, then copy the data using batch writes and switch traffic. This avoids any impact to the original table.
- B.Take a full database backup to Cloud Storage, restore it to a new instance, create the index on the restored instance, and then fail over to the new instance.
- C.Use the gcloud command 'gcloud spanner databases ddl update' with an ALTER TABLE statement to add the index. This will lock the table briefly but is acceptable.
- ✓ D.Use the gcloud command 'gcloud spanner databases ddl update' with a CREATE INDEX statement. The operation will be non-blocking and will not impact production traffic.
Why D: Cloud Spanner supports online, non-blocking index creation. The CREATE INDEX statement processes the index in the background and does not block reads or writes on the table. This is the most efficient and least impactful method. Using a backup/restore or export/import is unnecessarily complex and disruptive.
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.