Thursday, November 2, 2017

[google-cloud-sql-discuss] Re: Migrate from Cloud SQL to DataStore

You can definitely continue to keep your separate ids, but querying for the results will be slower as Datastore would then need to perform multiple equality filters in order to find the correct 'user_id', 'post_id', and 'cmnt_id' for an entity (and equality filters on Strings are never fast). 

To clarify, you may Only perform transactions on entity groups. This doesn't mean that ancestors are Only used for transactions. Ancestors provide quicker querying, strong consistency between updating an entity and retrieving the new results, As Well as the ability to perform transactions on them (all or nothing updates). It does so by placing the ancestor tree within the same entity group as you have correctly mentioned. This is actually much more optimized for querying as it minimizes the I/O required to find your results as mentioned in our Datastore Best Practices documentation

There are many advantages to structuring your data using only a single key with ancestors (e,g cleaner code, simpler logic, faster queries, etc) as appose to having multiple ID properties, but at the end of the day the choice is completely up to you.

Note that Google Groups is meant for general product discussions only. If you require technical support for the Datastore it is recommended to post your full questions to Stack Overflow using the supported Cloud tags. 

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/fb7561ba-4cb7-4426-b869-a4ed3ddf743d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment