Recall & Review
beginner
What is a Firestore index and why is it important?
A Firestore index is a data structure that helps Firestore quickly find and sort documents based on query conditions. It is important because without proper indexes, queries can be slow or fail to run.
Click to reveal answer
intermediate
What types of queries require composite indexes in Firestore?
Queries that filter or sort on multiple fields at the same time require composite indexes. For example, querying where 'status' is 'active' and ordering by 'createdDate' needs a composite index.
Click to reveal answer
beginner
How does Firestore handle queries without an existing index?
Firestore returns an error with a direct link to create the required index in the Firebase console. This helps you quickly add the needed index for your query to work.
Click to reveal answer
intermediate
What is the difference between single-field and composite indexes in Firestore?
Single-field indexes are automatically created for each field and support simple queries. Composite indexes combine multiple fields and support complex queries with multiple filters or sort orders.
Click to reveal answer
advanced
Why should you avoid unnecessary indexes in Firestore?
Unnecessary indexes increase storage costs and slow down write operations because Firestore updates all relevant indexes when data changes. Keeping only needed indexes improves performance and reduces cost.
Click to reveal answer
Which Firestore query requires a composite index?
✗ Incorrect
Queries that filter or order by multiple fields need composite indexes.
What happens if you run a Firestore query without the needed index?
✗ Incorrect
Firestore returns an error and provides a link to create the missing index.
Which index type is created automatically for each field in Firestore?
✗ Incorrect
Single-field indexes are created automatically for each field.
Why should you limit the number of indexes in Firestore?
✗ Incorrect
More indexes mean higher storage costs and slower write performance.
Which Firestore query can run without any composite index?
✗ Incorrect
Queries filtering or ordering by a single field use single-field indexes.
Explain how Firestore uses indexes to speed up queries and what happens if an index is missing.
Think about how a book index helps you find pages fast.
You got /4 concepts.
Describe best practices for managing Firestore indexes to balance performance and cost.
Less clutter means faster work and lower bills.
You got /4 concepts.