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_count DESC", account_key, topic).fetch(20)) or equivalently with the Query api: db.delete(entity.Entity.all(keys_only=True).filter('account_key', account_key).filter('topic', topic).order('-message_count').fetch(20)) -Nick Johnson On Wed, Jun 24, 2009 at 11:45 AM, Anders <i...@blabline.com> wrote: > > 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, "Nick Johnson (Google)" <nick.john...@google.com> > wrote: > > 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 <i...@blabline.com> wrote: > > > > > Has the delete function of records in the datastore started to take > > > much longer time? One Ajax call I have that deletes up to 20 records > > > often (more often than not perhaps) takes a very long time, where a > > > single request consumes around 8000cpu_ms and around 8000api_cpu_ms. > > > > > The records deleted are simple with only 10 properties of which only > > > one is a ReferenceProperty and the rest are single-line no-reference > > > properties. And no complicated indexes are used (as far as I know). > > > > -- > > Nick Johnson, App Engine Developer Programs Engineer > > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration > Number: > > 368047 > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---