简体   繁体   English

Objectify查询如何工作

[英]How does Objectify query works

Suppose I have this code: 假设我有以下代码:

    Query<Car> q = ofy().load().type(Car.class);
    for (Car car : q) {
        // Do something with car...
    }

How does Query<T> works, suppose the datastore contains million records, will Query load all Car objects into the memory or it will fetch it one by one from the datastore? 如何Query<T>的作品,假设数据存储包含百万条记录,将Query加载所有Car对象到内存或将取回一个一个从数据存储?

The default chunk size is 30 - see here . 默认的块大小为30-参见此处 Prefetch size is not set so it defaults to chunk size. 未设置预取大小,因此默认为块大小。

So, iterator will fetch 30 Entities at a time. 因此,迭代器一次将获取30个实体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM