views:

105

answers:

1

My devserver has become hideously slow for some reason. (Python, Windows 7, GAE 1.3.3) I'm not sure if I'm doing something wrong, or if it's just not meant to handle the load I'm putting on it. I have 1000 models of a certain type in the datastore. I am trying to delete them with this method:

def _deleteType(type):
    results = type.all().fetch(1000)
    while results:
        db.delete(results)
        results = type.all().fetch(1000)

It's taken 20+ minutes. I restarted the devserver, and the SDK console still said I have 1000 of these models in the DB. What's going on?

Is there a better way to cleanse my app of all data?

+4  A: 

Getting (and passing to db.delete) just the keys rather than the whole objects should be a bit faster. However, by far the fastest way to clear the datastore at start-up on the SDK is to start your app with:

 dev_appserver.py --clear_datastore myapp
Alex Martelli
Also making the query keys_only should speed it up a bit.
hwiechers
@hwiechers, yep, just as I said right at the very start of my concise answer, and I quote: "Getting (and passing to db.delete) just the keys rather than the whole objects should be a bit faster". Isn't that exactly what you're also saying?
Alex Martelli