You can set the chunk size to 100 or use one of the non iterator query methods. By default only 20 results are loaded at a time so for 100 results the iterator does 5 queries.

On 22 Feb 2010, at 02:23, Ftaylor wrote:

Is this the fastest way to load all of the Elements of a given type
from the DataStore?

@SuppressWarnings("unchecked")
        public static final List<Page> loadAllPagesFromDataStore() {
                List<Page> pages = new ArrayList<Page>();
                PersistenceManager pm = PMF.get().getPersistenceManager();
                Query query = null;
                try {
                        query = pm.newQuery(Page.class);
                        List<Page> results = (List<Page>)query.execute();
                        if(results.iterator().hasNext()) {
                                Iterator<Page> it = results.iterator();
                                while(it.hasNext())
                                        pages.add(pm.detachCopy(it.next()));
                        }
                } finally {
                        query.closeAll();
                        pm.close();
                }
                return pages;
        }

I ask because the datastore is meant to be very fast at reading huge
amounts of data, but slow at writing huge amounts of data, yet this
query is quite slow for only 100 elements.

Thanks,

Finbarr

--
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 .


--
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-j...@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