'MongoDB: As the number of fields to group by in $group increases will there be any performance impact?
I am looking for ways to improve my aggregation queries. In that context, I was wondering if the number of fields that get grouped impacts the performance of the aggregation? Because in certain cases we group by more than 5 to 6 fields.
In other words, as the number of fields to group by in $group pipeline increases will there be any performance impact compared to let's say when grouped by 1 or 2 fields?
More details:
If the answer to this is yes, it could negatively impact performance, then I plan to create a new field let's call it "cocatenated_field" inside which I will string concatenate values of all the multiple fields and then use only this one field for grouping.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
