Manage a solution that can span multiple database technologies →mediumMultiple ChoiceObjective-mapped
PCDE Practice Question: Manage a solution that can span multiple database technologies
An e-commerce application uses Firestore in Native mode. The team needs to run a query that filters on two fields and orders by a third field. What is the correct approach to ensure this query runs efficiently?
⚠ Common exam trap
A common misconception is that single-field indexes are sufficient for multi-field queries, or that index exemptions can optimize queries, when in fact composite indexes are mandatory for such queries in Firestore.
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 three fields
Firestore requires a composite index for queries that filter on multiple fields and order by a different field, because single-field indexes cannot satisfy the combined filtering and ordering constraints. Creating a composite index on the three fields (the two filter fields and the order field) allows Firestore to efficiently execute the query without scanning all documents.
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 composite index on the three fields
Why this is correct
Composite indexes must be created manually for queries that filter on multiple fields and order by another.
- ✗
Rely on automatic single-field indexes
Why it's wrong here
Automatic single-field indexes cannot support queries that filter on multiple fields or order by a different field.
- ✗
Use an index exemption on the fields
Why it's wrong here
Index exemptions are used to exclude arrays and maps from automatic indexing, not for composite indexes.
- ✗
Use Firestore in Datastore mode instead
Why it's wrong here
Datastore mode also requires composite indexes for multi-field queries; switching mode does not help.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCDE question from scratch — 1,446 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.