Hi Karan

the batch operation is a key.
 
http://googleappengine.blogspot.ru/2009/06/10-things-you-probably-didnt-know-about.html


5. You can batch put, get and delete operations for efficiency

Every time you make a datastore request, such as a query or a get() 
operation, your app has to send the request off to the datastore, which 
processes the request and sends back a response. This request-response 
cycle takes time, and if you're doing a lot of operations one after the 
other, this can add up to a substantial delay in how long your users have 
to wait to see a result.

Fortunately, there's an easy way to reduce the number of round trips: batch 
operations. The db.put(), db.get(), and db.delete() functions all accept 
lists in addition to their more usual singular invocation. When passed a 
list, they perform the operation on all the items in the list in a 
singledatastore round trip and they are executed in parallel, saving you a 
lot of time. For example, take a look at this common pattern:

for entity in MyModel.all().filter("color =",
    old_favorite).fetch(100):
  entity.color = new_favorite
  entity.put()

Doing the update this way requires one datastore round trip for the query, 
plus one additional round trip for each updated entity - for a total of up 
to 101 round trips! In comparison, take a look at this example:

updated = []
for entity in MyModel.all().filter("color =",
    old_favorite).fetch(100):
  entity.color = new_favorite
  updated.append(entity)
db.put(updated)

By adding two lines, we've reduced the number of round trips required from 
101 to just 2!


also, see this thread:
https://groups.google.com/forum/#!topic/appengine-ndb-discuss/04wiYYI26pc

WBR, Vitaly


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/beda9183-1848-4530-bfa2-0a989160064d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to