summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec')
-rw-r--r--src/mongo/db/exec/index_scan.cpp10
-rw-r--r--src/mongo/db/exec/multi_plan.cpp14
-rw-r--r--src/mongo/db/exec/subplan.cpp8
3 files changed, 23 insertions, 9 deletions
diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp
index e5a8cfe2019..9bedd8db6c7 100644
--- a/src/mongo/db/exec/index_scan.cpp
+++ b/src/mongo/db/exec/index_scan.cpp
@@ -33,7 +33,6 @@
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_cursor.h"
#include "mongo/db/index/index_descriptor.h"
-#include "mongo/db/query/explain.h"
#include "mongo/util/log.h"
namespace {
@@ -381,14 +380,7 @@ namespace mongo {
if (_specificStats.indexType.empty()) {
_specificStats.indexType = "BtreeCursor"; // TODO amName;
- // TODO this can be simplified once the new explain format is
- // the default. Probably won't need to include explain.h here either.
- if (enableNewExplain) {
- _specificStats.indexBounds = _params.bounds.toBSON();
- }
- else {
- _specificStats.indexBounds = _params.bounds.toLegacyBSON();
- }
+ _specificStats.indexBounds = _params.bounds.toBSON();
_specificStats.indexBoundsVerbose = _params.bounds.toString();
_specificStats.direction = _params.direction;
diff --git a/src/mongo/db/exec/multi_plan.cpp b/src/mongo/db/exec/multi_plan.cpp
index 2dd765d9553..19c16bbc7d3 100644
--- a/src/mongo/db/exec/multi_plan.cpp
+++ b/src/mongo/db/exec/multi_plan.cpp
@@ -110,6 +110,7 @@ namespace mongo {
if (!bestPlan.results.empty()) {
*out = bestPlan.results.front();
bestPlan.results.pop_front();
+ _commonStats.advanced++;
return PlanStage::ADVANCED;
}
@@ -140,10 +141,23 @@ namespace mongo {
_backupPlanIdx = kNoSuchPlan;
}
+ // Increment stats.
+ if (PlanStage::ADVANCED == state) {
+ _commonStats.advanced++;
+ }
+ else if (PlanStage::NEED_TIME == state) {
+ _commonStats.needTime++;
+ }
+
return state;
}
void MultiPlanStage::pickBestPlan() {
+ // Adds the amount of time taken by pickBestPlan() to executionTimeMillis. There's lots of
+ // execution work that happens here, so this is needed for the time accounting to
+ // make sense.
+ ScopedTimer timer(&_commonStats.executionTimeMillis);
+
// Run each plan some number of times. This number is at least as great as
// 'internalQueryPlanEvaluationWorks', but may be larger for big collections.
size_t numWorks = internalQueryPlanEvaluationWorks;
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp
index 5d4bcbd2dc0..281c0baafae 100644
--- a/src/mongo/db/exec/subplan.cpp
+++ b/src/mongo/db/exec/subplan.cpp
@@ -148,6 +148,10 @@ namespace mongo {
}
Status SubplanStage::planSubqueries() {
+ // Adds the amount of time taken by planSubqueries() to executionTimeMillis. There's lots of
+ // work that happens here, so this is needed for the time accounting to make sense.
+ ScopedTimer timer(&_commonStats.executionTimeMillis);
+
MatchExpression* theOr = _query->root();
for (size_t i = 0; i < _plannerParams.indices.size(); ++i) {
@@ -209,6 +213,10 @@ namespace mongo {
}
Status SubplanStage::pickBestPlan() {
+ // Adds the amount of time taken by pickBestPlan() to executionTimeMillis. There's lots of
+ // work that happens here, so this is needed for the time accounting to make sense.
+ ScopedTimer timer(&_commonStats.executionTimeMillis);
+
// This is what we annotate with the index selections and then turn into a solution.
auto_ptr<OrMatchExpression> theOr(
static_cast<OrMatchExpression*>(_query->root()->shallowClone()));