From 3e39c96ebbd90ebeb91d46f9dace6988a0152763 Mon Sep 17 00:00:00 2001 From: David Storch Date: Tue, 3 Jun 2014 11:04:28 -0400 Subject: SERVER-14096 explain find() at queryPlanner verbosity Enable by the setParameter 'enableNewExplain' --- src/mongo/db/exec/multi_plan.h | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/mongo/db/exec/multi_plan.h') 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* 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. -- cgit v1.2.1