Courseiva

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

A gaming company uses Firestore in Native mode to store player profiles and game state. They need to query the data by both 'playerId' and 'lastLoginTimestamp' sorted descending. The current index configuration is automatic. How should they configure indexing to support this query efficiently?

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 'playerId' ascending and 'lastLoginTimestamp' descending

Firestore automatically creates single-field indexes for all fields. For queries with ordering on two fields, a composite index is required. The composite index must include both fields in the correct order (ascending or descending).

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 two separate single-field indexes: one on 'playerId' and one on 'lastLoginTimestamp'

    Why it's wrong here

    Single-field indexes cannot satisfy a query that orders by both fields; a composite index is required.

  • Use an exemption to remove automatic indexing on 'playerId' and rely on single-field indexes

    Why it's wrong here

    Exemptions are for excluding fields from automatic indexing, not for composite queries.

  • Use the automatic index configuration; Firestore will create the necessary composite index automatically

    Why it's wrong here

    Firestore only creates single-field indexes automatically; composite indexes must be created manually.

  • Create a composite index on 'playerId' ascending and 'lastLoginTimestamp' descending

    Why this is correct

    Correct. A composite index with the exact order (asc/desc) is needed for efficient queries with ordering.

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.