Hi Pion, > On my Development Server, it returns the total number of the entities > which is over 40,000 entities. > > But when deploying it on GAE, it always returns 1,000 entities. Is > this because of this limitation > http://code.google.com/appengine/docs/java/datastore/overview.html#Quotas_and_Limits? > If so, what is the best way to find total number of entities I have? > If your query has no filter condition, I recommend the following query:
DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); Query query = new Query("__Stat_Kind__"); query.addFilter("kind_name", FilterOperator.EQUAL, kind); Entity stat = ds.prepare(query).asSingleEntity(); Long count = (Long) stat.getProperty("count"); If your query has some filter conditions, I recommend the following query: DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); Query query = new Query(kind); query.setKeysOnly(); query.addFilter(...); int count = ds.prepare(query).asList(FetchOptions.Builder.withOffset(0)).size(); The first query is faster than the second one. Hope this helps, Yasuo Higa --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---