
Answer-first summary for fast verification
Answer: Manually configure only the required composite indexes in your index.yaml file, specifying combinations such as actors and date_released or tags and date_released as needed for your queries.
Option A is correct because manually configuring the required composite indexes in your index configuration file (index.yaml) allows you to specify only the necessary combinations of properties (such as actors and date_released or tags and date_released) that your queries need. This targeted approach prevents Datastore from automatically creating all possible index combinations for multi-valued properties, which would lead to a combinatorial explosion in the number of indexes, increasing storage costs and slowing down writes. By defining only the indexes you need, you optimize both performance and resource usage
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are planning to deploy a new storage system for your mobile application, which serves as a media streaming service. After evaluating different options, you determine that Google Cloud Datastore is the most suitable solution for your needs. Your application has entities characterized by multiple properties, with some properties capable of taking multiple values. For instance, within the 'Movie' entity, both the 'actors' property and the 'tags' property can hold multiple values, whereas the 'date released' property is singular.
A typical query requirement for your application may include fetching all movies with a specific 'actor' identified as <actorname> and sorting the results by the 'date_released', or retrieving all movies categorized under the 'Comedy' tag sorted by 'date_released'.
How can you structure your indexing strategy to effectively prevent a combinatorial explosion in the number of indexes when handling these queries?
A
Manually configure only the required composite indexes in your index.yaml file, specifying combinations such as actors and date_released or tags and date_released as needed for your queries.
B
Allow Datastore to automatically create all possible composite indexes for multi-valued properties.
C
Set exclude_from_indexes = ['actors', 'tags'] in your entity options to prevent indexing those properties.
D
Set exclude_from_indexes = ['date_released'] in your entity options to prevent indexing the release date.