Are there any slick methods for Owned Collection item orphan removal?

26 views
Skip to first unread message

Brandon Donnelson

unread,
Feb 5, 2012, 11:49:22 AM2/5/12
to google-a...@googlegroups.com
Are there any slick datastore methods for Owned Collection orphan removal? 

Brandon Donnelson

Robert Kluin

unread,
Feb 6, 2012, 12:05:56 AM2/6/12
to google-a...@googlegroups.com
Hey Brandon,
Iterate over the _keys_ making sure the parent entity exists. You
could design it to prevent rechecking for the same parent over and
over, which will help reduce costs.

You can iterate over a lot of entities pretty fast with a keys-only
query. Insert one task per X parents you need to check. You'll need
to do some empirical testing, but I'd start with 500 or 1000, then do
a single batch get for them. If any aren't found, remove the
corresponding orphans. If you expect a lot of orphans, I'd use
smaller groups.


Robert

> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/FvITFUJIbMcJ.
> To post to this group, send email to google-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengi...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.

Reply all
Reply to author
Forward
0 new messages