Courseiva
Storing the Data →hardMultiple Choice

PDE Storing the Data Practice Question

A healthcare company stores patient imaging metadata in Cloud Firestore in Native mode. The application must run a query that returns all documents where the status field equals 'pending' and the region field equals 'us-east', ordered by created_at descending, and it must paginate through potentially millions of matching documents. Which Firestore capability should the engineer use to satisfy this requirement efficiently?

⚠ Common exam trap

The trap here is assuming single-field indexes or offset pagination can handle a multi-filter ordered query, when Firestore requires a composite index and cursors for scale.

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

✓

A composite index on status, region, and created_at, combined with cursor-based pagination.

Firestore automatically indexes single fields but requires a composite index when a query combines multiple equality filters with an orderBy on another field. Cursor-based pagination via startAfter scales to large result sets because it resumes from the last document rather than skipping offsets, making it the efficient, correct approach for this query pattern.

Answer analysis

Option-by-option breakdown

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

  • ✗

    A collection group query across all subcollections with an aggregation count.

    Why it's wrong here

    A collection group query targets documents across subcollections sharing a name, which is unrelated to filtering the status and region fields in this collection. It also does not provide ordered pagination over millions of matching documents, so it does not meet the requirement and would not be the right tool here.

  • ✗

    A single-field index on created_at with offset-based pagination using the skip parameter.

    Why it's wrong here

    A single-field index cannot serve a query that filters on status and region while ordering by created_at, so Firestore rejects it as requiring a composite index. Offset-based pagination also reads and discards skipped documents, which becomes expensive and inconsistent at millions of rows, making this approach incorrect.

  • ✓

    A composite index on status, region, and created_at, combined with cursor-based pagination.

    Why this is correct

    Firestore requires a composite index for queries combining equality filters on multiple fields with an orderBy on a different field. Cursor-based pagination using startAfter with the last document snapshot avoids the cost and inconsistency of offset-based paging, and it scales to millions of matching documents without re-reading skipped results.

  • ✗

    A distributed counter shard to track pending documents per region.

    Why it's wrong here

    Distributed counters address write contention on a single counter document, not query filtering and pagination. They cannot return the ordered document list the application needs, and maintaining them adds complexity without enabling the composite query. This is a scaling technique for counters, not a query solution for this scenario.

About these practice questions

This PDE question is part of Courseiva's 747-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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Google Cloud exam blueprint

This PDE 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 PDE exam.