Hello!
I have some data within my application that I want to expire after 1
week. To do this every day I get the 'Scheduler Service' (http://
schedulerservice.appspot.com/) to run a GET request to a page on my
app. This then runs a GQL that finds any records over 1 week old, and
deletes them.
Seems simple? I did a test with 24 records, and it took (Apparently)
'10706ms-cpu' time. 10 seconds to sort through 24 records??
Here is the code:
class clearapicallback(webapp.RequestHandler):
def get(self):
self.response.out.write('secret_callback_auth_code')
# 1 week = 604800
request = db.GqlQuery('SELECT * FROM Database WHERE time < :
1',time.time()-10).fetch(1000)
db.delete(request)
and the Database object:
class Database(db.Model):
pid = db.StringProperty()
uid = db.StringProperty()
sex = db.StringProperty()
qid = db.StringProperty()
qan = db.StringProperty()
anon = db.BooleanProperty()
time = db.FloatProperty()
My question is, why did it take 10 seconds!! It wasn't a fluke, other
requests have taken '17583ms-cpu' or more, with 23 records.
Can I make database records expire automatically (I don't want to use
memcache, unless it is good for storing data for a whole week)? And
how can I improve the performence?
I am expecting a lot more than 24 records to be deleted a day, and I
cant have it using that much CPU!
Regards
~Tom
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---