-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.1.0
-
Component/s: Aggregation Framework
-
None
-
ALL
This came from a DISQUS comment on the "Aggregation Framework" page:
I'm testing MongoDB 2.1.0 in order to evaluate the performance of the new aggregation framework. I'm wondering why it's 2x slower in my use case.
Here is the code I used before version 2.1.0 (using Python and pymongo):
db.customers.group(
{'segment': True}, None,
{'count': 0}, "function (obj, prev)
{ prev.count ++; }" )
Here is the same computation using the new aggregation framework:
db.command('aggregate', 'customers', pipeline=[ {'$group' : { '_id': '$segment', 'count':
{'$sum': 1}}} ])
On my computer with my dataset, the first version runs in ~1 s, the second version in ~2.5 s. Is it expected or am I doing something wrong?
- is depended on by
-
SERVER-5795 Very Poor Performances
- Closed
- is duplicated by
-
SERVER-5361 early $group should provide a hint to use an index matching the group key
- Closed
- is related to
-
SERVER-447 new aggregation framework
- Closed
-
SERVER-4507 aggregation: optimize $group to take advantage of sorted sequences
- Backlog