Hmm, I guess I could just leave it.
When displaying the data to the user I only show the last 20 records,
based on time. I read that the larger the datastore, the slower the
response time, so I tried to impliment some system to prune the data.

I guess I will just leave it!

Thanks for your help
Tom

On Dec 22, 2:10 pm, Matija <[email protected]> wrote:
> I think that your approach is not suitable for use on app engine. You
> will not be able to delete never more than few dozen. But instead of
> deletion why don't you filter your data (where you use it) to get only
> last week entries.
>
> Of course there is question why are you storing something that has
> value only for one week. Maybe some different approach in solving your
> business problem.
>
> On Dec 22, 2:05 pm, Tom <[email protected]> wrote:
>
> > Thanks Andrius, I will try to use the datetime module.
> > I tried beforehand, but I couldn't get it to work (For some reason),
> > so I reverted to use the time.time() function, which returned a float.
>
> > I also just tried using an integer rather than a float for the
> > time ,and it got slower...! -  '13056ms-cpu'
>
> > Regards, and have a happy christmas,
> > Tom
>
> > On Dec 22, 10:31 am, Andrius <[email protected]> wrote:
>
> > > Hello Tom,
>
> > > try to check index.yaml to see if index for for time property exists.
>
> > > Why do you have float type property for the time? it would be more
> > > efficient to use datetime or integer, because float is much heavier.
> > > And try to query without maximum limit, because it will be applied by
> > > default:
> > > If more than 1000 entities match the query, and either no limit is
> > > specified or a limit larger than 1000 is used, only the first 1000
> > > results are returned by fetch().
>
> > > Regards,
> > > Andrius
>
> > > On Dec 21, 11:17 pm, Tom <[email protected]> wrote:
>
> > > > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to