解释汇总框架 [英] Explain Aggregate framework

查看:48
本文介绍了解释汇总框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚阅读了此链接 Mongodb Explain for Aggregation框架,但没有解释我的问题

I Just read this link Mongodb Explain for Aggregation framework but not explain my problem

我想检索有关聚合的信息,例如db.coll.find({bla:foo}).explain()

I want retrieve information about aggregation like db.coll.find({bla:foo}).explain()

我尝试过

db.coll.aggregate([
        my-op
],
{
explain: true
}) 

结果不是Explain,而是数据库查询.

the result is not Explain, but the query on Database.

我也尝试过

db.runCommand({
        aggregate: "mycoll",
        pipeline: [
        my- op
        ],
        explain: true
    })

我使用此命令检索了信息,但我没有millis,nscannedObjects等...

I retrieved information with this command, but i haven't millis, nscannedObjects etc...

我使用mongoDb 2.6.2

I use mongoDb 2.6.2

推荐答案

聚合的运行方式不像传统查询那样,您也无法对其进行解释.它们实际上被归类为命令,尽管它们使用索引,但您无法随时了解它们是如何实时执行的.

Aggregations don't run like traditional queries and you can't run the explain on them. They are actually classified as commands and though they make use of indexes you can't readily find out how they are being executed in real-time.

您最好的选择是获取聚合的$ match部分,然后将其作为带有解释的查询运行,以弄清楚索引的性能如何,并对nscanned有所了解.

Your best bet is to take the $match portion of your aggregation and run it as a query with explain to figure out how the indexes are performing and get an idea on nscanned.

这篇关于解释汇总框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆