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 ...
随机推荐
- java学习笔记——大数据操作类
java.math包中提供了两个大数字操作类:BigInteger(大整数操作类) BigDecimal(大小数操作类). 大整数操作类:BigInteger BigInteger类构造方法:publ ...
- Neon Intrinsics各函数介绍
#ifndef __ARM_NEON__ #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) t ...
- redis配置不当可导致服务器被控制
服务器配置不当包括三个部分:1.Redis服务使用ROOT账号启动2.Redis服务无密码认证或者使用的是弱口令进行认证3.服务器开放了SSH服务,而且允许使用密钥登录 简单的写下过程 测试环境vic ...
- C中的C文件与h文件辨析
简单的说其实要理解C文件与头文件(即.h)有什么不同之处,首先需要弄明白编译器的工作过程,一般说来编译器会做以下几个过程: 1.预处理阶段 2.词法与语法分析阶段 .编译阶段,首先编译成纯 ...
- Codeforces Round #307 (Div. 2) E. GukiZ and GukiZiana (分块)
题目地址:http://codeforces.com/contest/551/problem/E 将n平均分成sqrt(n)块,对每一块从小到大排序,并设置一个总体偏移量. 改动操作:l~r区间内,对 ...
- Web用户的身份验证及WebApi权限验证流程的设计和实现(续)
4.4 权限属性RequireAuthorizationAttribute [csharp] view plaincopy "font-size:14px;">/// / ...
- Ansible@一个高效的配置管理工具--Ansible configure management--翻译(五)
无书面许可请勿转载 高级Playbook Extra variables You may have seen in our template example in the previous chapt ...
- jquery的find()
jQuery 遍历 - find() 方法 jQuery 遍历参考手册 实例 搜索所有段落中的后代 span 元素,并将其颜色设置为红色: $("p").find("sp ...
- Win7 设置、访问共享文件夹
一.设置共享文件夹 右键点击文件夹,打开“属性”窗口,选择“共享”选项卡 点击“共享”按钮,打开“文件共享”窗口,在下拉列表中选择账户,点“添加”,最后点“共享”按钮. 二.访问 \\192.168. ...
- UVA 10209
10209 - Is This Integration ? #include <stdio.h> #include <math.h> /* */ //多次错误都是因为我将PI定 ...