Home > Software design >  Do entities found in ndb queries count (for pricing) the same as get operations?
Do entities found in ndb queries count (for pricing) the same as get operations?

Time:06-08

I'm looking at the per entity read pricing for Google Cloud https://cloud.google.com/datastore/pricing

Is it the same cost if the entity is found via query vs. direct get() by key? Basically, is it cheaper to run queries to find the entity instead?

CodePudding user response:

From your linked documentation

Projection queries that do not use the distinct on clause. This type of query is counted as a single entity read for the query itself. The individual results are counted as small operations.

Keys-only queries. A keys-only query is counted as a single entity read for the query itself. The individual results are counted as small operations.

Small operations are free.

My interpretation (this is my own understanding which could be wrong) is - A direct get by key or projection query costs just a single read but a standard query will cost you a read for the query and a read for retrieving the result.

  • Related