summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/multi_plan.h
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2014-06-03 11:04:28 -0400
committerDavid Storch <david.storch@10gen.com>2014-06-11 11:57:00 -0400
commit3e39c96ebbd90ebeb91d46f9dace6988a0152763 (patch)
tree147db9b069d4c65e8233a3f826dde9cefeddf60c /src/mongo/db/exec/multi_plan.h
parentc4db5777873c4973facc7ea5ba727565e7658d73 (diff)
downloadmongo-3e39c96ebbd90ebeb91d46f9dace6988a0152763.tar.gz
SERVER-14096 explain find() at queryPlanner verbosity
Enable by the setParameter 'enableNewExplain'
Diffstat (limited to 'src/mongo/db/exec/multi_plan.h')
-rw-r--r--src/mongo/db/exec/multi_plan.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/mongo/db/exec/multi_plan.h b/src/mongo/db/exec/multi_plan.h
index 359f3381198..fe25dcddfde 100644
--- a/src/mongo/db/exec/multi_plan.h
+++ b/src/mongo/db/exec/multi_plan.h
@@ -53,6 +53,11 @@ namespace mongo {
virtual ~MultiPlanStage();
+ /**
+ * Helper used by the destructor to delete losing candidate plans.
+ */
+ void clearCandidates();
+
virtual bool isEOF();
virtual StageState work(WorkingSetID* out);
@@ -69,7 +74,7 @@ namespace mongo {
void addPlan(QuerySolution* solution, PlanStage* root, WorkingSet* sharedWs);
/**
- * Runs all plans added by addPlan, ranks them, and picks a best. Deletes all loser plans.
+ * Runs all plans added by addPlan, ranks them, and picks a best.
* All further calls to getNext(...) will return results from the best plan.
*/
void pickBestPlan();
@@ -90,6 +95,35 @@ namespace mongo {
*/
bool hasBackupPlan() const;
+ /**
+ * Gathers execution stats for all losing plans.
+ */
+ vector<PlanStageStats*>* generateCandidateStats();
+
+ //
+ // Used by explain.
+ //
+
+ /**
+ * Runs the winning plan into it hits EOF or returns DEAD, throwing out the results.
+ * Execution stats are gathered in the process.
+ *
+ * You can call this after calling pickBestPlan(...). It expects that a winning plan
+ * has already been selected.
+ */
+ Status executeWinningPlan();
+
+ /**
+ * Runs the candidate plans until each has either hit EOF or returned DEAD. Results
+ * from the plans are thrown out, but execution stats are gathered.
+ *
+ * You can call this after calling pickBestPlan(...). It expects that a winning plan
+ * has already been selected.
+ */
+ Status executeAllPlans();
+
+ static const char* kStageType;
+
private:
//
// Have all our candidate plans do something.