diff --git a/core/src/main/java/google/registry/model/ofy/DatastoreTransactionManager.java b/core/src/main/java/google/registry/model/ofy/DatastoreTransactionManager.java index d91911f68..eb5703ded 100644 --- a/core/src/main/java/google/registry/model/ofy/DatastoreTransactionManager.java +++ b/core/src/main/java/google/registry/model/ofy/DatastoreTransactionManager.java @@ -480,7 +480,13 @@ public class DatastoreTransactionManager implements TransactionManager { @Override public long count() { - return buildQuery().count(); + // Objectify provides a count() function, but unfortunately that doesn't work if there are + // more than 1000 (the default response page size?) entries in the result set. We also use + // chunkAll() here as it provides a nice performance boost. + // + // There is some information on this issue on SO, see: + // https://stackoverflow.com/questions/751124/how-does-one-get-a-count-of-rows-in-a-datastore-model-in-google-app-engine + return Iterables.size(buildQuery().chunkAll().keys()); } @Override