node.js - Why Group is slower than $group from Aggregate? -


this question has answer here:

i tried bench 3 methods group data: native js (with underscore), group , aggregate $group

i uses these datas (genre/position' trees in paris) (237 168 rows, 35mo)

this script test , result bit surprising !

┌─────────────┬───────────────┐ │ method      │ avg time (ms) │ ├─────────────┼───────────────┤ │ pure js     │ 897           │ ├─────────────┼───────────────┤ │ group       │ 3863          │ ├─────────────┼───────────────┤ │ aggregation │ 364           │ └─────────────┴───────────────┘ 

why grouping group 10x slower aggregation ? used "group" ? , how can optimise again request ?

thanks.

group command uses same framework mapreduce , there many resources why mr slower aggregation framework. main 1 runs in separate js thread, agg framework runs natively on server.

see details here mongodb aggregation comparison: group(), $group , mapreduce


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -