Courseiva

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

Your Firestore database in Native mode is used by a mobile app. You need to query a collection where documents are filtered by two fields: 'status' (string) and 'createdAt' (timestamp). The query is not performing as expected. What action is required?

⚠ Common exam trap

Google Cloud often tests the misconception that single-field indexes are sufficient for multi-field queries, but Firestore requires composite indexes for any query combining equality and range filters on different fields.

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 'createdAt' fields.

Firestore in Native mode requires a composite index to efficiently query documents filtered by multiple fields, such as 'status' and 'createdAt'. Without this index, the query may fail or perform poorly, as Firestore cannot combine separate single-field indexes for equality and range filters. Option C is correct because creating a composite index on both fields enables the query to run as expected.

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 for the collection to allow multi-field queries.

    Why it's wrong here

    Index exemptions are used to exclude fields from automatic indexing, not to enable multi-field queries.

  • Add a third field to the query to make it more specific.

    Why it's wrong here

    Adding a third field does not address the root cause of poor query performance, which is the absence of a composite index covering both 'status' and 'createdAt'. Firestore requires a composite index for any query filtering on multiple fields; merely increasing specificity without creating that index will still force a full collection scan. This option is tempting because, in other database systems, adding filter predicates can reduce result sets and improve speed, but Firestore's index-based architecture demands explicit index creation, not additional query fields.

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

    Why this is correct

    Composite indexes are required for multi-field queries. Firestore does not automatically create them.

  • Ensure that single-field indexes exist for both 'status' and 'createdAt'.

    Why it's wrong here

    Single-field indexes exist automatically, but they do not support combined queries on multiple 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.