mongo explain分析详解
1 为什么要执行explain,什么时候执行
explain的目的是将mongo的黑盒操作白盒化。
比如查询很慢的时候想知道原因。
2 explain的三种模式
2.1 queryPlanner
不会真正的执行查询,只是分析查询,选出winning plan。
2.2 executionStats
返回winning plan的关键数据。
executionTimeMillis该query查询的总体时间。
2.3 allPlansExecution
执行所有的plans。
通过explain("executionStats")来选择模式,默认是第一种模式。
3 queryPlanner分析
3.1 namespace
本次所查询的表。
3.2 indexFilterSet
是否使用partial index,比如只对某个表中的部分文档进行index。
3.3 parsedQuery
本次执行的查询
3.4 winning plan
3.4.1 stage
COLLSCAN:全表扫描
IXSCAN:索引扫描
FETCH:根据索引去检索指定document
SHARD_MERGE:将各个分片返回数据进行merge
SORT:表明在内存中进行了排序
LIMIT:使用limit限制返回数
SKIP:使用skip进行跳过
IDHACK:针对_id进行查询
winning plan的stage是一个树状结构,最外面的stage是根节点,然后inputStage或者inputStages里面的stage是它的子stage。
The explain results present the query plans as a tree of stages. Each stage passes its results (i.e. documents or index keys) to the parent node. The leaf nodes access the collection or the indices. The internal nodes manipulate the documents or the index keys that result from the child nodes. The root node is the final stage from which MongoDB derives the result set.
explain.queryPlanner.winningPlan.stage A string that denotes the name of the stage.
Each stage consists of information specific to the stage. For instance, an IXSCAN stage will include the index bounds along with other data specific to the index scan. If a stage has a child stage or multiple child stages, the stage will have an inputStage or inputStages.
explain.queryPlanner.winningPlan.inputStage A document that describes the child stage, which provides the documents or index keys to its parent. The field is present if the parent stage has only one child.
3.4.2 filter
对子stage返回的结果进行过滤,filter给本stage指明了fetch的条件。
3.4.3 inputStage
用于容纳一个子stage。
3.4.3.1 stage
子stage
3.4.3.2 indexName
所使用的索引的名字。
3.4.3.3 indexBounds
索引查找时使用的范围。
4 db.getCollection("AndroidDataReport").getIndexes()解析
每个json是一个索引,如果key有多个就是复合索引,复合索引的顺序很重要。
mongo explain分析详解的更多相关文章
- 转载:MySQL EXPLAIN 命令详解学习
转载自:https://blog.csdn.net/mchdba/article/details/9190771 MySQL EXPLAIN 命令详解 MySQL的EXPLAIN命令用于SQL语句的查 ...
- MySQL EXPLAIN 命令详解
MySQL EXPLAIN 命令详解 MySQL的EXPLAIN命令用于SQL语句的查询执行计划(QEP).这条命令的输出结果能够让我们了解MySQL 优化器是如何执行SQL 语句的.这条命令并没有提 ...
- Memcache的使用和协议分析详解
Memcache的使用和协议分析详解 作者:heiyeluren博客:http://blog.csdn.NET/heiyeshuwu时间:2006-11-12关键字:PHP Memcache Linu ...
- wav文件格式分析详解
wav文件格式分析详解 文章转载自:http://blog.csdn.net/BlueSoal/article/details/932395 一.综述 WAVE文件作为多媒体中使用的声波文件格式 ...
- 线程组ThreadGroup分析详解 多线程中篇(三)
线程组,顾名思义,就是线程的组,逻辑类似项目组,用于管理项目成员,线程组就是用来管理线程. 每个线程都会有一个线程组,如果没有设置将会有些默认的初始化设置 而在java中线程组则是使用类ThreadG ...
- HanLP中人名识别分析详解
HanLP中人名识别分析详解 在看源码之前,先看几遍论文<基于角色标注的中国人名自动识别研究> 关于命名识别的一些问题,可参考下列一些issue: l ·名字识别的问题 #387 l ·机 ...
- Explain 参数详解,重点部分已经全部完成,还有少数几个参数没不理解没标注。
Explain 参数详解,重点部分已经全部完成,还有少数几个参数没不理解没标注.http://naotu.baidu.com/file/cdb631355392e317e1d925dc2e48f592 ...
- GC日志分析详解
点击返回上层目录 原创声明:作者:Arnold.zhao 博客园地址:https://www.cnblogs.com/zh94 GC日志分析详解 以ParallelGC为例,YoungGC日志解释如下 ...
- MongoDB执行计划分析详解
要保证数据库处于高效.稳定的状态,除了良好的硬件基础.高效高可用的数据库架构.贴合业务的数据模型之外,高效的查询语句也是不可少的.那么,如何查看并判断我们的执行计划呢?我们今天就来谈论下MongoDB ...
随机推荐
- 速查笔记(Linux Shell编程<下>)
转载自: http://www.cnblogs.com/stephen-liu74/archive/2011/11/04/2228133.html 五.BASH SHELL编程: 1. 初始化顺 ...
- linux下rar包的解压方法
linux下rar包的解压方法 学习了:https://blog.csdn.net/yonggeit/article/details/72190246?utm_source=itdadao&u ...
- jquery给多个span赋值
因为我想在页面载入完毕后,有几个地方显示当前时间,所以我须要给多个span赋值. span代码的写法例如以下: <span name="currentDate">< ...
- ARM指令中的函数调用
1. 重要寄存器 SP 栈指针, 每一种异常模式都有其自己独立的r13,它通常指向异常模式所专用的堆栈,也就是说五种异常模式.非异常模式(用户模式和系统模式),都有各自独立的堆栈,用不同的堆栈指针来 ...
- Unix环境部署
http://www.cnblogs.com/chuyuhuashi/p/4423699.html 分布式javahttp://www.cnblogs.com/tangyanbo/p/4499485. ...
- JavaScript 获取文件名,后缀名
function getBaseName(str) { var segs = str.split('.'); if(segs.length > 1) segs.pop(); return seg ...
- c#创建对象并动态添加属性
//动态类,可以作为基类被继承 dynamic backObj = new ExpandoObject(); //ExpandoObject 为密封类 backObj.image0 = IMGNAME ...
- C# Html Agility Pack
using System; using HtmlAgilityPack; using System.IO; using System.Text; using System.Text.RegularEx ...
- Spring事务管理之声明式事务管理:基于TransactionProxyFactoryBean的方式
© 版权声明:本文为博主原创文章,转载请注明出处 案例 - 利用Spring的声明式事务(TransactionProxyFactoryBean)管理模拟转账过程 数据库准备 -- 创建表 CREAT ...
- Google 全球 IP 地址库
## Google 全球 IP 地址库 IP 地址来源:http://www.kookle.co.nr Bulgaria 93.123.23.1 93.123.23.2 93.123.23.3 93. ...