A. +1 on tim's suggestion.as an example (in Python), the following
piece of code...
for obj in Object.all():
obj.delete() # thousands of individual delete()s
... should run way slower than...
Object.all(keys_only=True)
db.delete(posts) # one massive delete()
the second is faster in 2 ways:
1) keys-only means that it doesn't have to fetch the actual data
2) uses the google.appengine.ext.db.delete() once where you pass in
individual keys
B. another alternative is the new Datastore Admin where you can
manually bulk delete entities:
http://code.google.com/appengine/docs/python/datastore/creatinggettinganddeletingdata.html#Deleting_Entities_in_Bulk
http://googleappengine.blogspot.com/2010/10/new-app-engine-sdk-138-includes-new.html
C. other alternatives
when a game finishes, *must* you do the deletes before returning back
to the user? if it's not critical, then you can farm out this job to a
task queue or use the new mapper API (half of the MapReduce solution).
more info on both at:
Tasks Queue API
http://code.google.com/appengine/docs/python/taskqueue/overview.html
Mapper API
http://googleappengine.blogspot.com/2010/07/introducing-mapper-api.html
http://code.google.com/p/appengine-mapreduce/
http://code.google.com/appengine/articles/mr/mapper.html
if deletion is complex, you may also consider the new Pipeline API:
http://code.google.com/p/appengine-pipeline/
http://news.ycombinator.com/item?id=2013133
hope this helps!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
http://corepython.com
wesley.chun : wesc+api at google.com : @wescpy
developer relations :: google app engine
@app_engine :: googleappengine.blogspot.com
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.