As far as I am aware, the only documented reason to use an entity group is 
because it can give you strong consistency, which does not necessarily 
require a transaction. To take your example, let's imagine we are trying to 
decide if a user's "favourite colors" should be a list property on the User 
entity, a separate entity with a "user" reference (not in the same entity 
group), or a separate entity with the same parent. Consider a user takes 
the following actions:

1. Add "blue" to my list of favourite colors.
2. Query for my favourite colors.


Case: Single entity: Result: You will always see the last color that was 
added, since the read and write is of the same entity.

Case: Multiple entities, not in an entity group. Result: Unknown! You might 
see "blue", you might not. If there are many concurrent additions and 
deletions, you might see any combination of them. That is because queries 
across entities are weakly consistent.

Case: Multiple entities in an entity group, using an ancestor query. 
Result: You will see blue. This query gives you strong consistency, even 
without the transaction.


Note this has nothing to do with latency or throughput. I have not seen 
suggestions in the app engine documents about either (if they exist, let me 
know!)


For details, see:

https://cloud.google.com/appengine/articles/transaction_isolation

https://cloud.google.com/appengine/docs/python/datastore/structuring_for_strong_consistency

https://cloud.google.com/appengine/docs/python/datastore/entities#Python_Ancestor_paths




On Tuesday, October 4, 2016 at 8:23:24 PM UTC-4, Paul Mazzuca wrote:
>
> Is there any reason to use an Entity Group in Google Datastore other than 
> for enabling transactions?  
>
> For example, does having entities in the same entity group speed up 
> queries?  The situation that I run into often is whether to have X be a 
> parent to Y or have X be a property of Y.   Both cases allow for Y to be 
> queried given X, but when transactions aren't needed perhaps the entity 
> group is not necessary.  I guess another way of stating the question is 
> whether or not ancestor queries provide speed up over property based 
> queries without ancestors?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/8ff7de78-f4bc-455b-9ddb-b29a660a3c81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to