my app is producing significantly high mcycles used results. i have
debugged it and determined that the problem is in my for loop. So I
tried two versions and both are too slow.

Version 1:

somestuff = ['cat', 'dog', 'cow'];

toquery = "SELECT * FROM Animals Where id IN (" + somestuff + ")"
users = db.GqlQuery(toquery)

now i get a list of users that match that key and I do a for loop like
this:

for user in users:
   self.response.out.write(user.id)

Gives me a lot of mcycles with a red hazard warning. If I remove the
for loop the hazard goes away. The datastore query takes less then a
second.

VERSION 2

somestuff = ['cat', 'dog', 'cow'];

for animal in somestuff:
   toquery = "SELECT * FROM Moodster Where id = '" + animal + '\''
   for user in users:
       self.response.out.write(user.id)

in the latter version I am doing many queries (in this case 3) but
because there is only one user in users for each query (i make sure of
this), it takes less mcycles and gets a faster response

AM I DOING SOMETHING WRONG?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to