jd_sharp
jd_sharp

Reputation: 53

Objectify - how efficient is a key-only query filtered by ancestor?

I am trying to get all the children of a given parent entity efficiently. The only way to do that now is to use a query in objectify, which is not efficient because it bypasses the cache. Objectify-4 adds hybrid queries, which you can mimic in Objectify 3.x by issuing a key only query and then doing a batch get on those keys.

My question is how efficient is a key-only query that filters using an ancestor? Something like:

ofy.query(Car.class).ancestor(someKey).fetchKeys();

I don't want to get all keys for all "Cars" here, I only want "Cars" that belong to a specific parent.

Upvotes: 1

Views: 1206

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

Your query will get all Car entities which are children of given parent entity.

Billing docs state that keys-only query costs 1 read + 1 small operation per retrieved entity.

Upvotes: 2

Related Questions