Aggregation pipeline stage metrics
We are working on a pipeline Query, Its taking good amount of time. We have lot of stages. it would be good we can get know which stage is taking more time.
Is there any way we can get the stats of each pipeline stage like approx duration, no of a document?
is there a way we can identify how much CPU or memory that entire pipeline took?
![](https://secure.gravatar.com/avatar/2f5722100bec9be333c6e3c3d46fb3e0?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
I'm moving this request to Compass, since it seems that the request is about usability fo representation
-
MAHESH commented
We found Third-party tool Studio3T which does what i propsoed above.. https://studio3t.com/knowledge-base/articles/build-mongodb-aggregation-queries/
we can use explain as suggested, very difficult to do analysis. Compass is in no way matching this tool's capabilities.
-
You can run explain() for your aggregation to see number of documents and execution time
db.collection.explain('executionStats').aggregate([...])