开发者社区 问答 正文

MongoDB可以做相较复杂一点的统计吗?

比如类似 select sum(*) ,userType from user group by userType 这样的统计.
mongodb的groupby必须有主键, 遇到select sum(*) from user就没辙了
而内置的mapreduce官方说不是实时的,不建议使用
The price of using MapReduce is speed: group is not particularly speedy, but
MapReduce is slower and is not supposed to be used in “real time.” --- MongoDB权威指南
那么MongoDB就不能做统计了吗?

展开
收起
落地花开啦 2016-02-05 17:14:10 2953 分享 版权
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人

    解决这类海量数据的统计查询问题,推荐试用两种方法:
    1 使用列式存储的数据库
    2 使用流式计算方式,增量更新统计的结果
    比用缓存管用

    2019-07-17 18:37:58
    赞同 展开评论