-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Verbose explain plans on aggregations (that are not simplified to a find command) include metrics such as nReturned and executionTimeMillisEstimate for each stage in their output. We should augment that with a counter reflecting how many times the stage was executed.
Note that we indirectly have that under the "right" circumstances for $lookup as it can manifest as collectionScans. Hopefully that's the uncommon case and adding an iteration counter would obviously give us that count in all cases and also allow for computation of things like average work per iteration. Moreover, it's presently possible for a $lookup to be executed an indefinite number of times but for all of the totalDocsExamined, totalKeysExamined, and collectionScans to report 0 thus hiding work/iterations.