google app engine - Datastore query with limit -
i'm using remoteapi (java) go through large dataset, ~90k entities, , perform data migration.
int chunk_size = 500; int limit = 900; queryresultlist<entity> result = ds.prepare(entityquery) .asqueryresultlist( fetchoptions.builder .withprefetchsize(chunk_size) .limit(limit) .chunksize(chunk_size) ).startcursor(cursor); with query limit set 900the result.size() entire dataset, ~90k, instead of 900. if try lower limit, 300, result size expected 1 (300).
what missing here? documentation couldn't figure out why produces behaviour i'm describing here.
based on these examples (http://www.programcreek.com/java-api-examples/index.php?api=com.google.appengine.api.datastore.queryresultlist)
i think should use .withlimit(limit) instead of .limit(limit) within .asqueryresultlist options
so restructure code follows:
fetchoptions options = fetchoptions.builder .withlimit(limit) .withprefetchsize(chunk_size) .chunksize(chunk_size); queryresultlist<entity> result = ds.prepare(entityquery) .asqueryresultlist(options); then cursor
result.getcursor();
Comments
Post a Comment