You are creating an App Engine application that uses Cloud Datastore as its persistence layer.
You need to retrieve several root entities for which you have the identifiers.
You want to minimize the overhead in operations performed by Cloud Datastore.
What should you do?
Click on the arrows to vote for the correct answer
A. B. C. D.A.
When working with Cloud Datastore, if you need to retrieve multiple entities with known identifiers, there are two approaches available: batch get and batch query.
Batch get operation requires you to create a Key object for each entity that you want to retrieve and then run a batch get operation. This approach is recommended when you have a small number of entities to retrieve as it minimizes the overhead of operations performed by Cloud Datastore. With batch get, all entities are fetched in a single request, so the network latency is reduced.
On the other hand, batch query operation allows you to retrieve entities based on a query filter that you create using the identifiers. This approach is recommended when you have a large number of entities to retrieve, as it allows you to filter the entities based on certain criteria before fetching them. With batch query, entities are fetched in batches and the network latency is higher than batch get, but it allows you to limit the number of entities returned and apply filters to retrieve only the necessary entities.
Based on the above, option A is the correct answer, as it minimizes the overhead in operations performed by Cloud Datastore while retrieving the required root entities. Options B, C, and D would result in additional operations, thus increasing the overhead in operations performed by Cloud Datastore.