summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/plan_stats.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/plan_stats.h')
-rw-r--r--src/mongo/db/exec/plan_stats.h67
1 files changed, 64 insertions, 3 deletions
diff --git a/src/mongo/db/exec/plan_stats.h b/src/mongo/db/exec/plan_stats.h
index fa326b536d2..dab069ed6c2 100644
--- a/src/mongo/db/exec/plan_stats.h
+++ b/src/mongo/db/exec/plan_stats.h
@@ -55,13 +55,17 @@ namespace mongo {
// Every stage has CommonStats.
struct CommonStats {
- CommonStats() : works(0),
+ CommonStats(const char* type)
+ : stageTypeStr(type),
+ works(0),
yields(0),
unyields(0),
invalidates(0),
advanced(0),
needTime(0),
isEOF(false) { }
+ // String giving the type of the stage. Not owned.
+ const char* stageTypeStr;
// Count calls into the stage.
size_t works;
@@ -73,6 +77,10 @@ namespace mongo {
size_t advanced;
size_t needTime;
+ // BSON representation of a MatchExpression affixed to this node. If there
+ // is no filter affixed, then 'filter' should be an empty BSONObj.
+ BSONObj filter;
+
// TODO: have some way of tracking WSM sizes (or really any series of #s). We can measure
// the size of our inputs and the size of our outputs. We can do a lot with the WS here.
@@ -80,6 +88,9 @@ namespace mongo {
// the user, eg. time_t totalTimeSpent;
bool isEOF;
+ private:
+ // Default constructor is illegal.
+ CommonStats();
};
// The universal container for a stage's stats.
@@ -292,6 +303,17 @@ namespace mongo {
};
+ struct LimitStats : public SpecificStats {
+ LimitStats() : limit(0) { }
+
+ virtual SpecificStats* clone() const {
+ LimitStats* specific = new LimitStats(*this);
+ return specific;
+ }
+
+ size_t limit;
+ };
+
struct MultiPlanStats : public SpecificStats {
MultiPlanStats() { }
@@ -322,6 +344,18 @@ namespace mongo {
std::vector<size_t> matchTested;
};
+ struct ProjectionStats : public SpecificStats {
+ ProjectionStats() { }
+
+ virtual SpecificStats* clone() const {
+ ProjectionStats* specific = new ProjectionStats(*this);
+ return specific;
+ }
+
+ // Object specifying the projection transformation to apply.
+ BSONObj projObj;
+ };
+
struct SortStats : public SpecificStats {
SortStats() : forcedFetches(0), memUsage(0), memLimit(0) { }
@@ -340,6 +374,12 @@ namespace mongo {
// What's our memory limit?
size_t memLimit;
+
+ // The number of results to return from the sort.
+ size_t limit;
+
+ // The pattern according to which we are sorting.
+ BSONObj sortPattern;
};
struct MergeSortStats : public SpecificStats {
@@ -359,6 +399,9 @@ namespace mongo {
// How many records were we forced to fetch as the result of an invalidation?
size_t forcedFetches;
+
+ // The pattern according to which we are sorting.
+ BSONObj sortPattern;
};
struct ShardingFilterStats : public SpecificStats {
@@ -372,6 +415,17 @@ namespace mongo {
size_t chunkSkips;
};
+ struct SkipStats : public SpecificStats {
+ SkipStats() : skip(0) { }
+
+ virtual SpecificStats* clone() const {
+ SkipStats* specific = new SkipStats(*this);
+ return specific;
+ }
+
+ size_t skip;
+ };
+
struct TwoDStats : public SpecificStats {
TwoDStats() { }
@@ -394,6 +448,8 @@ namespace mongo {
// Geo hashes generated by GeoBrowse::fillStack.
// Raw data for explain index bounds.
std::vector<GeoHash> expPrefixes;
+
+ BSONObj keyPattern;
};
struct TwoDNearStats : public SpecificStats {
@@ -406,9 +462,11 @@ namespace mongo {
size_t objectsLoaded;
- // Since 2d's near does all its work in one go we can't divine the real nscanned from
- // anything else.
+ // Since 2d's near does all its work in one go we can't divine the real number of
+ // keys scanned from anything else.
size_t nscanned;
+
+ BSONObj keyPattern;
};
struct TextStats : public SpecificStats {
@@ -425,6 +483,9 @@ namespace mongo {
// Human-readable form of the FTSQuery associated with the text stage.
BSONObj parsedTextQuery;
+
+ // Index keys that precede the "text" index key.
+ BSONObj indexPrefix;
};
} // namespace mongo