Why are key related queries free?

In accordance with the price documents here , the request keys-onlyis free. Thus, it seems that you can save the reading by doing the following (pseudocode):

qo = ndb.QueryOptions(keys_only = True)
qry = ModelName.query().filter("name" = "Bob")
keys = qry.fetch(20, options = qo) #keys-only fetch

Then after that I can get my entities by evaluating 1 reading per entity:

entities = ndb.get_multi(keys)

Why is this considered better than fetching objects (i.e. fetching only for keys)?

Also, where does the request come from? When is it running fetchor when is an object querycreated?

+4
source share
1 answer

"", 1 . RPC .

(.. ), , . RPC, , , , , , . RPC ( batch_size, RPC-, ).

, , - RPC, , , , . , RPC, .

, , , fetch. .

, -: . , , "" , . , , , , , , , , -.

+7

Source: https://habr.com/ru/post/1548558/


All Articles