gpt4 book ai didi

java - Apache Ignite SqlFieldsQuery 游标问题

转载 作者:太空宇宙 更新时间:2023-11-04 12:03:33 30 4
gpt4 key购买 nike

我使用 SqlFieldsQuery 来缓存 ~1_000_000 行。

QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery("select num from some_cache"))

我已经了解了查询游标的惰性性质 ( http://apacheignite.gridgain.org/docs/cache-queries#section-querycursor )。但似乎缓存中的所有数据都是一次性加载的。因为我的查询需要很长时间,而cursor.getAll()会立即返回包含所有数据的集合。

这是缺少某些配置还是预期的行为?

最佳答案

getAll 确实一次返回所有行。

QueryCursor 扩展了 Iterable,使用迭代器来利用惰性。

QueryCursor<List> cursor = cache.query(new SqlFieldsQuery("select num from some_cache"))
for (List l : cursor)
doSomething(l);

关于java - Apache Ignite SqlFieldsQuery 游标问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40653768/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com