问题描述
引用 http://www.mongodb.org/display/DOCS/MapReduce#MapReduce-Parallelism
没有并行性,与更简单或更传统的查询和数据聚合方法相比,MapReduce有什么好处?
Without parallelism, what are the benefits of MapReduce compared to simpler or more traditional methods for queries and data aggregation?
为避免混淆:问题不是面向文档的数据库比传统的关系数据库有什么好处"
To avoid confusion: the question is NOT "what are the benefits of document-oriented DB over traditional relational DB"
推荐答案
在更简单或更传统的查询上使用MapReduce的主要原因是,它可以完成简单查询无法完成的事情(即聚合).
The main reason to use MapReduce over simpler or more traditional queries is that it simply can do things (i.e., aggregation) that simple queries cannot.
一旦需要聚合,则可以使用MongoDB使用两个选项:MapReduce和group命令. group命令类似于SQL的"group by",其局限性在于它必须在单个数据库响应中返回所有结果.这意味着只能在结果少于4MB的情况下使用组.另一方面,MapReduce可以执行分组依据"可以执行的任何操作,但是会将结果输出到新的集合中,因此结果可以根据需要而变大.
Once you need aggregation, there are two options using MongoDB: MapReduce and the group command. The group command is analogous to SQL's "group by" and is limited in that it has to return all its results in a single database response. That means group can only be used when you have less than 4MB of results. MapReduce, on the other hand, can do anything a "group by" can, but outputs results to a new collection so results can be as large as needed.
此外,并行性即将到来,因此最好进行一些练习:)
Also, parallelism is coming, so it's good to have some practice :)
这篇关于MongoDB:在没有并行性的情况下使用MapReduce有什么意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!