Courseiva

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

A company uses Firestore in Native mode for their application. They need to query a collection where documents must match a specific field value and be sorted by a different field. The query filters on 'status' and orders by 'timestamp'. What should the engineer do to ensure the query performs optimally?

⚠ Common exam trap

Google exams often test the misconception that automatic single-field indexes are sufficient for all queries, but the trap here is that queries combining an equality filter and an order by on different fields always require a composite index.

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 composite index on the 'status' and 'timestamp' fields.

Firestore requires a composite index when a query includes both an equality filter on one field (status) and an order by clause on a different field (timestamp). Without this composite index, Firestore cannot efficiently satisfy both the filter and the sort order in a single index scan, leading to suboptimal performance or query failure. Creating a composite index on (status, timestamp) allows Firestore to use a single index to match the filter and return results in the requested order.

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 an index exemption to improve query performance.

    Why it's wrong here

    Index exemptions are used to exclude indexes on arrays and maps, not to improve performance.

  • Use a collection group query to bypass index requirements.

    Why it's wrong here

    Collection group queries also need indexes; they do not bypass index requirements.

  • Rely on automatic single-field indexes; they will cover the query.

    Why it's wrong here

    Single-field indexes are not sufficient for combined filter and order queries.

  • Create a composite index on the 'status' and 'timestamp' fields.

    Why this is correct

    A composite index is required for queries with both an equality filter and an order by on different fields.

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.