Micro
Micro

Reputation: 10891

Is it slower to load an entity from the Datastore by key versus querying for it?

Is it slower to load an entity from the Datastore by key versus querying for it? Is there a performance difference there and if so why or why not?

(When querying for it, let's assume you query on some property equal to some value of an entity that you know only one of exists in your Datastore so only one entity will be returned)

Upvotes: 0

Views: 48

Answers (1)

Jim Morrison
Jim Morrison

Reputation: 2887

It's faster to load an entity directly by key because the system can directly load the entity. With a query the database must query an index, get the key from an index, then load the entity.

Upvotes: 1

Related Questions