我有一个简单的查询在foxx里面运行
For u in collection
Filter u.someIndexedSparseFiler !=null
Return {_id:u._id}
在日志中,arango会显示一条到达有限内存堆的消息,并终止进程。
reached heap-size limit of #3 interrupting V8 execution (heap size limit 3232954528, used 3060226424) during V8 internal collection
即使我在启动时添加了**--javascript.v8-max-heap 3000**标志,它仍然运行在相同的错误中。我该怎么办?有没有比这更好的方法
1条答案
按热度按时间7ivaypg91#
我不知道为什么会出现内存不足的错误,但是看起来返回的数据溢出了V8堆的大小。另一种可能性是有什么东西导致引擎丢失/忽略索引,导致引擎在计算
someIndexedSparseFiler
属性之前加载每个文档。评估数百万个文档(或大量大型文档)不仅会消耗大量磁盘/内存I/O,而且还可能需要大量RAM。尝试使用explain特性返回查询分析-它应该会告诉您哪里出了问题。
为了进行比较,我的查询...
...当我单击“解释”时,返回以下内容:
请注意,它在
Indexes used:
下列出了我的稀疏索引。另外,尝试将!=
更改为==
,您将看到现在它忽略了该索引!这是因为优化程序知道稀疏索引永远不会有null
值,所以它会跳过它。如果您不熟悉“explain”功能,那么它在优化查询和创建索引时是非常有用的(实际上是必不可少的)。在这种情况下,索引应仅具有一个属性,否则“选择性”商可能太低,引擎将忽略它。