wish of those help I'm studying the Google Cloud Datastore GQL grammar - specifically the HAS ANCESTOR and HAS DESCENDANT comparison operators. , These two GQL queries should produce identical results:
SELECT * FROM Person WHERE __key__ HAS ANCESTOR KEY('Person', 'Amy')
SELECT * FROM Person WHERE KEY('Person', 'Amy') HAS DESCENDANT __key__
Does supplying an ancestor improve filter queries performance in objectify / google cloud datastore?
should help you out Including an ancestor should not significantly affect query performance (and as you note, each option requires a different index). The more important consideration when deciding to use ancestor queries is whether you require strongly consistent query results. If you do, you'll need to group your entities into entity groups and use an ancestor query (#1 in your example).
Google Cloud Datastore: how to query all distinct Parent/Ancestor?
like below fixes the issue You should note that the datastore ancestry is not established at the entity kind level: you can't really say that the Order kind has a User kind as ancestor. The ancestry is established at the entity level - an entity has an ancestor only if one is specified at the entity creation level, otherwise it doesn't have one. Also it doesn't matter what kind the ancestor entity is, different entities of the same kind can have ancestors of different kinds or no ancestors at all.
Google Datastore ancestor query returning data too far down