When to use entity groups in GAE's Datastore

前端 未结 2 734
慢半拍i
慢半拍i 2021-01-02 01:17

Following up on my earlier question regarding GAE Datastore entity hierarchies, I\'m still confused about when to use entity groups.

Take t

2条回答
  •  独厮守ぢ
    2021-01-02 01:30

    If you don't need transactions, don't use entity groups. They slow things down in some cases, and never speed anything up. Their only benefit is that they enable transactions.

    As far as I can tell, the best place to use entity groups is on data that isn't likely to be accessed by many users at the same time, and that you'll frequently want to include in a transaction. So, if you stored the contents of a shopping cart, which probably only the owner of that cart will deal with frequently, those contents might be good for an entity group - it'll be nice to be able to use a transaction for that data when you're adding or updating an entity, and you're not locking anyone else out of anything when you do so.

提交回复
热议问题