Courseiva

PCDE Practice Question: Manage a solution that can span multiple database technologies

A Cloud Spanner database has a table with a primary key and a secondary index. The application frequently queries using a filter on the secondary index column and orders by the primary key. The queries are slow. What should the database administrator do to improve query performance?

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

Create a covering index using CREATE INDEX with the STORING clause to include the required columns

Cloud Spanner can use a secondary index to filter on a column, but when ordering by the primary key, Spanner often must fetch rows from the base table and then sort them, which is slow. Creating a covering index with the STORING clause includes all columns needed by the query (the filter column and the primary key, as well as any other selected columns). This allows Spanner to satisfy the query entirely from the index, avoiding both the table lookup and the sort, because the index already stores the primary key in order. Option C is the correct syntax: `CREATE INDEX ... ON table (filter_column) STORING (other_columns)`.

Answer analysis

Option-by-option breakdown

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

  • Increase the number of nodes to improve query throughput

    Why it's wrong here

    Scaling nodes improves throughput but does not optimise a specific slow query.

  • Create an interleaved table that mirrors the data

    Why it's wrong here

    Interleaved tables are for parent-child relationships, not for query optimisation.

  • Create a covering index using CREATE INDEX with the STORING clause to include the required columns

    Why this is correct

    A covering index includes all columns needed for the query, allowing Spanner to avoid accessing the base table, which can improve performance.

  • Use ALTER TABLE to add a new index on the filter column

    Why it's wrong here

    ALTER TABLE cannot add an index; you must use CREATE INDEX.

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 →

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.