10M集合上的聚合框架性能

时间:2013-12-04 16:09:46

标签: mongodb

我有10M文档的集合,这是每日事件的预聚合。

一个简单的$group花费超过8秒,这种表现是否正常?

分析器的某些日期:

{
    "op" : "command",
    "ns" : "analytics.$cmd",
    "command" : {
        "aggregate" : "aggregation",
        "pipeline" : [
            {
                "$group" : {
                    "_id" : "",
                    "hits" : {
                        "$sum" : "$hits"
                    }
                }
            }
        ]
    },
    "ntoreturn" : 1,
    "keyUpdates" : 0,
    "numYield" : 15,
    "lockStats" : {
        "timeLockedMicros" : {
            "r" : NumberLong(17169805),
            "w" : NumberLong(0)
        },
        "timeAcquiringMicros" : {
            "r" : NumberLong(8582619),
            "w" : NumberLong(294)
        }
    },
    "responseLength" : 78,
    "millis" : 8594,
    "ts" : ISODate("2013-12-04T15:57:38.217Z"),
    "client" : "127.0.0.1",
    "allUsers" : [ ],
    "user" : ""
}

这是一个单一的文件

{
    "_id" : ObjectId("529e21ee67e807418500daeb"),
    "date" : ISODate("2012-09-19T00:00:00Z"),
    "hits" : 1,
    "infos" : {
        "sourceValue" : NumberLong(1),
        "eventType" : "createUser",
        "sourceType" : "user",
        "instance" : "xxx",
        "targetType" : "user",
        "targetValue" : NumberLong(15)
    }
}

0 个答案:

没有答案