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?
Choose an answer
Tap an option to check your answer.
Correct answer: Create the Key object for each Entity and run a batch get operation.
Why this is the answer
The most efficient way to retrieve multiple entities by their identifiers in Cloud Datastore is to create a Key object for each entity and then perform a single batch get operation. This minimizes the number of round trips to the database, reducing latency and operational overhead. Running multiple individual get operations (second option) is less efficient because each operation incurs its own network latency and transaction overhead. Using query filters (third and fourth options) is generally less efficient than direct key lookups when you already have the full identifiers. Queries involve index lookups and potentially more processing, even for simple equality filters on keys. Batch get operations are optimized for direct retrieval by key.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed