【问题标题】:Objectify: Datastore small operations for count queriesObjectify:用于计数查询的数据存储小操作
【发布时间】:2014-12-23 18:37:33
【问题描述】:

根据谷歌文档

Small datastore operations include calls to allocate datastore ids or keys-only queries, and these operations are free.

如果下面的查询返回 10,000;那是“一次小操作”还是“10,000 次读取操作”

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

【问题讨论】:

标签: google-app-engine google-cloud-datastore objectify


【解决方案1】:

您的查询将花费 1 次查询读取操作和 10,000 次结果小操作。

执行此操作会更节省内存(尽管在数据存储操作方面没有什么不同):

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

【讨论】:

  • 你好,@stickfigure 为什么会有一个读取操作,我可以知道吗?
  • 一个查询总是有 1 个读取操作。 (当然,除非他们最近改变了一些东西)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-08
  • 1970-01-01
  • 1970-01-01
  • 2019-09-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多