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 ...
随机推荐
- 【iOS开发-55】图片轮播案例:scrollView的分页、滚动栏、利用代理控制定时器和Page Control以及多线程问题
案例: (1)用storyboard布局,这里用了三样东西. --UIScrollView就是我们准备存放滚动图片的容器. --Page Control就是控制页数的那几个小点点.能够设置有多少个点. ...
- Oracle 11g Flashback_transaction_query的undo_sql为空解决办法
近日测试的时候发现 flashback_transaction_query中 undo_sql 为空,经查证这个问题是 Oracle 11g 默认把 supplemental logging 禁用了导 ...
- 查看文章 mysql:表注释和字段注释
查看文章 mysql:表注释和字段注释 学习了:https://blog.csdn.net/chamtianjiao/article/details/6698690 2 修改表的注释 alter ta ...
- [Tools] Deploy a Monorepo to Now V2
Now by Zeit has recently been updated and now supports multi-language monorepos. In this lesson we'l ...
- java学习笔记——日期处理
获取系统当前时间使用:java.util.Date类,而这个Date的构造方法如下: 无参构造:public Date() 有参构造:public Date(long date) 第一个实例: imp ...
- javascript 设计模式 -- 发布/订阅模式
直接上代码: index.html : <!DOCTYPE html> <html lang="en"> <head> <meta cha ...
- 【BIEE】10_资料库查看数据报错
导入元数据后,在资料库右键物理表名,[查看数据]报错: 出现这个问题,没搞明白是为啥- 后来百度意外发现一个方法,修改NQSConfig.INI文件即可解决问题 那么就开始来搞定这个问题 [1]打开路 ...
- Oracle 隐式游标 存储过程
--隐式游标 注意变量赋值用(:=) 连接符用(||)而不是加号(+) DECLARE v_pk T_PLAT_KEYWORD.ID%TYPE; --主键 v_amount_message T_PLA ...
- 设计模式之十一:抽象工厂模式(Abstract Factory)
抽象工厂模式: 提供了一个创建一系列相关的或相互依赖的对象的接口而不须要详细指定它们的类型. Provide an interface for creating families of related ...
- rational rose画UML图
原文见:http://blog.csdn.net/cjr15233661143/article/details/8532997 UML是一种建模语言,是系统建模的标准.我们之所以建模是因为大规模的系统 ...