Google app engine Objectify:用于计数查询的数据存储小操作

Google app engine Objectify:用于计数查询的数据存储小操作,google-app-engine,google-cloud-datastore,objectify,Google App Engine,Google Cloud Datastore,Objectify,根据谷歌文档 Small datastore operations include calls to allocate datastore ids or keys-only queries, and these operations are free. 如果以下查询返回10000;这是“一个小操作”还是“10000次读取操作” int count = ofy().load().type(Employee.class).filter("location", "US").keys().list()

根据谷歌文档

Small datastore operations include calls to allocate datastore ids or keys-only queries, and these operations are free.
如果以下查询返回10000;这是“一个小操作”还是“10000次读取操作”

int count = ofy().load().type(Employee.class).filter("location", "US").keys().list().size();

您的查询将需要对查询执行1次读取操作,并对结果执行10000次小操作

执行以下操作将提高内存效率(尽管在数据存储操作方面没有什么不同):

int count = ofy().load().type(Employee.class).filter("location", "US").count();

@PaulCollingwood刚刚添加了appstats,它正在接受10K读取调用。appstats定价是一种不可用的检查成本的方法,您可以检查配额页面,运行代码,看看读取次数或小操作是否增加。您好,@stickfigure为什么有一个读取操作,我可以知道吗?查询总是有一个读取操作。(当然,除非他们最近有所改变)