Aggregation framework slower than group()?

65 views
Skip to first unread message

Nicolas Grilly

unread,
Feb 10, 2012, 8:43:46 PM2/10/12
to mongod...@googlegroups.com
Hello list,

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 and 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?

Cheers,

Nicolas

Scott Hernandez

unread,
Feb 11, 2012, 8:54:55 AM2/11/12
to mongod...@googlegroups.com

The framework is still being developed. Providing feedback with sample data, your pipelines and your experiences is good but there are still lots of optimizations to be made.

See the other questions/responses for a list of some of the optimations coming.

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/UsXhFwSjE0wJ.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Nicolas Grilly

unread,
Feb 11, 2012, 11:13:06 AM2/11/12
to mongod...@googlegroups.com
Thanks for your answer Scott. I'll redo my tests in a few weeks with the next release.

Scott Hernandez

unread,
Feb 11, 2012, 11:25:32 AM2/11/12
to mongod...@googlegroups.com
The first official release will be the 2.2.0 (stable) release.
Currently this is a developer preview or unstable development release
depending on who you.

Here is a little background on versioning and release numbers.
http://www.mongodb.org/display/DOCSKR/Version+Numbers

> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.

Reply all
Reply to author
Forward
0 new messages