summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_ranker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/plan_ranker.h')
-rw-r--r--src/mongo/db/query/plan_ranker.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/query/plan_ranker.h b/src/mongo/db/query/plan_ranker.h
index 698f92d0cb9..217c21f8744 100644
--- a/src/mongo/db/query/plan_ranker.h
+++ b/src/mongo/db/query/plan_ranker.h
@@ -39,6 +39,7 @@
#include "mongo/db/exec/plan_stats.h"
#include "mongo/db/exec/working_set.h"
#include "mongo/db/query/query_solution.h"
+#include "mongo/util/container_size_helper.h"
namespace mongo {
@@ -106,6 +107,18 @@ struct PlanRankingDecision {
return decision;
}
+ uint64_t estimateObjectSizeInBytes() const {
+ return // Add size of each element in 'stats' vector.
+ container_size_helper::estimateObjectSizeInBytes(
+ stats, [](const auto& stat) { return stat->estimateObjectSizeInBytes(); }, true) +
+ // Add size of each element in 'candidateOrder' vector.
+ container_size_helper::estimateObjectSizeInBytes(candidateOrder) +
+ // Add size of each element in 'scores' vector.
+ container_size_helper::estimateObjectSizeInBytes(scores) +
+ // Add size of the object.
+ sizeof(*this);
+ }
+
// Stats of all plans sorted in descending order by score.
// Owned by us.
std::vector<std::unique_ptr<PlanStageStats>> stats;