[google-app-engine] Google App Engine 항목 그룹
When you're doing queries, you can use ancestor() to restrict the query to children of a particular entity - in your example, you could look for only descendants of B
, which you couldn't do if they were all at the top level.
There's more on Ancestor Queries in Programming Google App Engine
The Keys and Entity Groups doc also says that:
Entity group relationships tell App Engine to store several entities in the same part of the distributed network ... All entities in a group are stored in the same datastore node
edit: The same document also lists some of the reasons why you don't want your entity groups to grow too large:
The more entity groups your application has—that is, the more root entities there are—the more efficiently the datastore can distribute the entity groups across datastore nodes. Better distribution improves the performance of creating and updating data. Also, multiple users attempting to update entities in the same entity group at the same time will cause some users to retry their transactions, possibly causing some to fail to commit changes. Do not put all of the application's entities under one root.
Any transaction on an entity in a Group will cause any other writes to the same entity group to fail. If you have a large entity group with lots of writes, this causes lots of contention, and your app then has to handle the expected write failures. Avoiding datastore contention goes into more detail on the strategies you can use to minimse the contention.
-------------------실제로 트랜잭션은 항목 그룹의 부작용입니다. 항목 그룹 행이 같은 위치에 있기 때문에 트랜잭션이 전혀 가능합니다.
항목 그룹이 계층 적 데이터베이스와 유사하게 만드는 데이터 저장소의 고유 속성이라고 주장하는 데까지 갈 것입니다.
-------------------A-> B-> C를 저장하면 A에는 B가 많고 B에는 C가 많이 있습니다. A-> B 및 A-> C를 저장하면 A에는 B가 많고 C가 많습니다. 즉, C는 단일 B에 속하지 않습니다.
실제로 사용하는 구조는 저장하는 데이터에 따라 다릅니다.
많은 쓰기 액세스를 사용하는 경우 엔티티 그룹에 직관적이지 않은 작업을 수행해야 할 수 있습니다. 이에 대한 예는 샤딩 카운터 를 참조하십시오 .
출처
https://stackoverflow.com/questions/2002909