summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_explainer_impl.cpp
diff options
context:
space:
mode:
authorMaddie Zechar <mez2113@columbia.edu>2022-10-10 16:22:03 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-10 17:16:27 +0000
commitdbd868972c766d7a272e7cb3fcd2f3c792b2dd83 (patch)
tree03784fb830fc1005ff41b5f846f0715794309ccc /src/mongo/db/query/plan_explainer_impl.cpp
parentdf498b17710f364a853c4dc1731cbdc6ec91e0f5 (diff)
downloadmongo-dbd868972c766d7a272e7cb3fcd2f3c792b2dd83.tar.gz
SERVER-64978 Add metrics to track if a plan was recovered from the plan cache
Diffstat (limited to 'src/mongo/db/query/plan_explainer_impl.cpp')
-rw-r--r--src/mongo/db/query/plan_explainer_impl.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/query/plan_explainer_impl.cpp b/src/mongo/db/query/plan_explainer_impl.cpp
index 0b70636945a..dc118081b33 100644
--- a/src/mongo/db/query/plan_explainer_impl.cpp
+++ b/src/mongo/db/query/plan_explainer_impl.cpp
@@ -722,6 +722,10 @@ void PlanExplainerImpl::getSummaryStats(PlanSummaryStats* statsOut) const {
const CachedPlanStats* cachedStats =
static_cast<const CachedPlanStats*>(cachedPlan->getSpecificStats());
statsOut->replanReason = cachedStats->replanReason;
+ // Nonnull replanReason indicates cached plan was less effecient than expected and an
+ // alternative plan was chosen.
+ statsOut->replanReason ? statsOut->fromPlanCache = false
+ : statsOut->fromPlanCache = true;
} else if (STAGE_MULTI_PLAN == stages[i]->stageType()) {
statsOut->fromMultiPlanner = true;
} else if (STAGE_COLLSCAN == stages[i]->stageType()) {