Courseiva

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

An application uses Cloud Firestore. The team notices that queries on a collection with an array field are slow. They want to create an index on the array field. What should they do?

⚠ Common exam trap

Google Cloud often tests the misconception that array fields cannot be included in composite indexes without special handling, but Firestore supports composite indexes containing array fields by default.

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 array field and another field.

Cloud Firestore does not support single-field indexes on array fields. To enable efficient queries involving array fields, you must create a composite index that includes the array field along with another field. This allows Firestore to use the composite index for array-contains queries and other array operations, improving query performance.

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 a collection group index on the field.

    Why it's wrong here

    Collection group indexes are for queries across subcollections.

  • Create a composite index on the array field and another field.

    Why this is correct

    Correct. A composite index that includes the array field is required to support array queries efficiently. This index enables the use of array-contains and other array-related operations.

  • Create an index exemption for the array field.

    Why it's wrong here

    Incorrect. Index exemptions are used to exclude certain fields from automatic indexing, not to enable indexing on arrays. For array fields, you need an explicit composite index.

  • Rely on the automatically created single-field index.

    Why it's wrong here

    Automatic index does not support array queries.

About these practice questions

One of 1,446 original PCDE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.