[google-appengine] Re: Datastore delete taking long time

2009-06-24 Thread Anders
Hmm... On a second thought, the put operation is perhaps also costly in terms of CPU time. I haven't tried doing 20 puts in one page access. Maybe that would also consume a lot of CPU time. On a practical level, this is usually not a big problem when the traffic to the application is low, but imag

[google-appengine] Re: Datastore delete taking long time

2009-06-24 Thread Anders
Sometimes delete operations are implemented to be allowed to take more time than put operations. Could it be that the delete operation in GAE has been allowed to be slow in order to make put operations and/or queries faster? --~--~-~--~~~---~--~~ You received this m

[google-appengine] Re: Datastore delete taking long time

2009-06-24 Thread Anders
I have now changed it to the second variant, with the Query api, and the result for 3 test calls was: 6775cpu_ms 6687api_cpu_ms 6757cpu_ms 6687api_cpu_ms 6765cpu_ms 6687api_cpu_ms That's perhaps a slight improvement, but I have also done vacuum_indexes which could perhaps have improved the perfo

[google-appengine] Re: Datastore delete taking long time

2009-06-24 Thread Nick Johnson (Google)
Hi Anders, You don't actually need the entities in order to delete them - only their keys. Also, you can do all the deletes in a single batch operation. This ought to be substantially faster: db.delete(db.GqlQuery("SELECT __key__ FROM Entity WHERE account_key = :1 AND topic = :2 ORDER BY message_

[google-appengine] Re: Datastore delete taking long time

2009-06-24 Thread Anders
First I get the entities using a query, something like: entities = entity.Entity.gql('WHERE account_key = :1 AND topic = :2 ORDER BY message_count DESC LIMIT 20', account_key, topic) Then a loop calling delete() on each entity: for entity in entities: entity.delete() On Jun 24, 12:29 pm,

[google-appengine] Re: Datastore delete taking long time

2009-06-24 Thread Nick Johnson (Google)
Hi Anders, How are you deleting the entities? Are you fetching them first, or deleting them by providing the keys? And are you deleting them in a single batch, or one at a time? -Nick Johnson On Wed, Jun 24, 2009 at 7:44 AM, Anders wrote: > > Has the delete function of records in the datastore