Mongo聚合/Mongo聚合的性能可以做什么 [英] What can be done with Mongo Aggregation / Performance of Mongo Aggregation

查看:100
本文介绍了Mongo聚合/Mongo聚合的性能可以做什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个MongoDB.我想按某些分组进行汇总.我找到了这个文档,它会帮我做到这一点.一切正常,但指出了某些限制:

I built a MongoDB. I want to do aggregation by certain grouping. I found this document, which will do that for me. Everything is ok, but certain limitations are pointed out:

  1. 管道的输出只能包含16 MB.如果你的结果 如果设置超出此限制,则聚合命令将产生错误.

  1. Output from the pipeline can only contain 16 megabytes. If your result set exceeds this limit, the aggregate command produces an error.

如果任何单个聚合操作消耗了超过10%的资源 系统RAM的操作将产生错误.

If any single aggregation operation consumes more than 10 percent of system RAM the operation will produce an error.

聚合系统当前将$group操作存储在内存中, 处理大量的组时可能会导致问题.

The aggregation system currently stores $group operations in memory, which may cause problems when processing a larger number of groups.

MongoDB聚合可以处理多少行/文档?恐怕要用这个.有人可以指导我吗?

How many rows / documents can I process with MongoDB aggregation? I am afraid to use this. Can anyone guide me about this?

推荐答案

我从Google网上论坛获得了有效且有用的答案.希望与大家分享.

文件数量不受限制:最终结果(或中间结果)使用的内存量不受限制.

The limitation is not on the number of documents: the limitation is on the amount of memory used by the final result (or an intermediate result).

因此:如果您汇总了20万份文档,但结果适合16MB的结果,那么您就可以了.如果您汇总了100个文档,而结果却不足16 MB,则会出现错误.

So: if you aggregate 200 000 documents but the result fits into the 16MB result, then you're fine. If you aggregate 100 documents and the result does not fit into 16 MB, then you'll get an error.

类似地,如果对中间结果执行sort()或group(),并且该操作需要超过10%的可用RAM,那么您将得到一个错误.这只是与您拥有多少个文档有松散的关系:它取决于管道的特定阶段的大小.

Similarly, if you do a sort() or a group() on an intermediate result, and that operation needs more than 10% of available RAM, then you'll get an error. This is only loosely related to how many documents you have: it's a function of how big the particular stage of the pipeline is.

我可以通过任何设置增加16MB吗?

Can i increase 16MB via any settings?

仅对最终结果有16MB的限制,还是针对特定结果 汇总(均值,中间结果+任何临时资产+ 最终结果)?

Is 16MB limitation only for End-Result OR Is that for that particular aggregation (means, intermediate results + any temporary holdings + End result)?

16MB的限制是无法调整的.这是MongoDB中文档的最大大小.由于聚合框架当前是作为命令实现的,因此聚合结果必须在单个文档中返回:因此限制为16 MB.

The 16MB limit is not adjustable. This is the maximum size of a document in MongoDB. Since the Aggregation framework is currently implemented as a command, the result from the aggregation must be returned in a single document: hence the 16 MB limit.

请参见发布

这篇关于Mongo聚合/Mongo聚合的性能可以做什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆