I have found deleting to be the most CPU hungry activity - more than putting the data in the first place. Using code similar to below I have used over an hour of CPU time in one 30 second request!

So I wonder if that is why this option doesn't exist in the GUI... people would be gutted to hit their quota just from deleting a kind. But if it did not count towards the quota that would be fantastic. In the same way that creating indexes is free CPU time as long as you do it after entering your data.

On 23 Jan 2010, at 03:30, Larry Cable wrote:

+1 especially for large tables

On Jan 22, 10:47 am, Locke <[email protected]> wrote:
It would be good to have the ability to do this from within the GUI.
Other database management tools have "empty table" options, so a
"delete all of this Kind" feature would be appropriate.

On Jan 22, 12:59 pm, John Patterson <[email protected]> wrote:



Here is the code I use to delete one kind at a time - it batches the
keys into Lists of 100 to avoid datastore exceptions.  Iterables is
from Google collections.

Query query = new Query(kind);
                                        query.setKeysOnly();
DatastoreService datastore = ... Iterable<Entity> entityIterator =
datastore.prepare(query).asIterable();
Iterable<Key> keyIterator = Iterables.transform(entityIterator,
new Function<Entity, Key>()
                                        {
public Key apply(Entity arg0)
                                                {
return arg0.getKey();
                                                }
                                        });

Iterable<List<Key>> partitioned =
Iterables.partition(keyIterator, 100);
for (List<Key> sublist : partitioned)
                                        {
datastore.delete(sublist);
                                        }

On 22 Jan 2010, at 15:10, mete wrote:

Suppose I have a class A and I have stored some instance of it in the datastore. Then I change it, but I keep the name. How I can delete all
the previous data in the datastore, if I simply do a query and use
deleteAll, it gives an error (I guess because I changed the name of
some fields). Thank you.

Mete

--
You received this message because you are subscribed to the Google
Groups "Google App Engine for Java" 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 
athttp://groups.google.com/group/google-appengine-java?hl=en
.- Hide quoted text -

- Show quoted text -

--
You received this message because you are subscribed to the Google Groups "Google App Engine for Java" 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-java?hl=en .


--
You received this message because you are subscribed to the Google Groups "Google 
App Engine for Java" 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-java?hl=en.

Reply via email to