请教下mongodb聚合查询mapreduce和aggregate的区别,性能上比较使用哪个更好?
-
如果是过百万的数据量,那么聚合查询mapreduce和aggregate两者在使用上有没有性能上的区别?
-
method allowDiskUse out function aggregate true pipeline/collection false group false pipeline true mapReduce jsMode pipeline/collection true - aggregate 基於累加操作的的聚合 可以重複利用 $project/$group 一層一層聚合資料, 可以用於大量資料(單輸出結果小於 16MB) 不可用於分片資料
- mapReduce 可以處理超大資料集 需要嚴格遵守 mapReduce 中的結構一致/冪等 寫法, 可增量輸出/合併
if you are sending map-reduce queries to your Mongo backend and are concerned about performance, you should try switching to the
Aggregation framework as soon as possible.More importantly: running tests like this can help you and your organization become more
data-driven when it comes to making design decisions for your application environment.Curious to see how your own MongoDB deployment
performs? Sign up for the beta, install the Sysdig Monitor agents, and you'll be running your own MongoDB experiments in just a matter of minutes.
ref:
本帖下載内容已隐藏,请登入以查看隐藏内容!
-
常常有此疑惑... 收藏
-
原來如此,收藏~
-
釐清觀念! 值得收藏
-
所以以這個例子來看,不是很清楚過百萬的數據量是使用 aggregate 還是 mapReduce 較好? 還是都可以?
-
看起來是建議用aggregate來取代mapreduce吧
-
[補充]
mapreduce跟aggregate都不走索引
所以如果是一般查詢(走索引)可實現的查詢語句
使用MapReduce跟aggregate效能不一定會比較好