MongoDB: Terrible MapReduce Performance

前端 未结 4 963
攒了一身酷
攒了一身酷 2020-12-07 10:42

I have a long history with relational databases, but I\'m new to MongoDB and MapReduce, so I\'m almost positive I must be doing something wrong. I\'ll jump right into the qu

4条回答
  •  天涯浪人
    2020-12-07 11:12

    You are not doing anything wrong. (Besides sorting on the wrong value as you already noticed in your comments.)

    MongoDB map/reduce performance just isn't that great. This is a known issue; see for example http://jira.mongodb.org/browse/SERVER-1197 where a naive approach is ~350x faster than M/R.

    One advantage though is that you can specify a permanent output collection name with the out argument of the mapReduce call. Once the M/R is completed the temporary collection will be renamed to the permanent name atomically. That way you can schedule your statistics updates and query the M/R output collection real-time.

提交回复
热议问题