Hi,

I'm trying to optimize my use of the Datastore. One of my slowest
operations reads all of the entities from a table and updates the
information in them all. I currently do this like so:


========================
PersistenceManager pm = PMF.get().getPersistenceManager();
Extent extent = pm.getExtent(Users.class);

for(Object userObj : extent) {
    User user = (User)userObj;

    // only update active users
    if(user.isActive()) {
        //
        // in here I set some fields for each active user
        //
    }

}

// closs all fields and automatically save all the User objects
extent.closeAll();

========================


My User class is a POJO with various getters/setters for the data. It
contains 13 fields and the primary key is a string.

What is the best way to improve this? The User table currently only
has 100 or so users but it could potentially grow to thousands. This
operation runs every 10 minutes via cron and it takes about 30-40
seconds to complete!!

What happens when extent.closeAll() is called? will it do multiple
writes or is it a batch save?

I'm currently using GAE v1.5.1 but am looking to move to v1.6 in the
near future.

Thanks,
J

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to