|
Author:
{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}
Message: SERVER-4816 Sharded agg $sort now merges sorted streams
This enables using indexes for sorting on shards, and gives better distribution of work.
Explain before:
mongos> db.runCommand({aggregate:'foo', explain:true, pipeline: [{$sort: {_id:1}}]})
|
{
|
"splitPipeline" : {
|
"shardsPart" : [ ],
|
"mergerPart" : [
|
{
|
"$sort" : {
|
"sortKey" : {
|
"_id" : 1
|
}
|
}
|
}
|
]
|
},
|
"shards" : {
|
"shard0000" : {
|
"host" : "localhost:30001",
|
"stages" : [
|
{
|
"$cursor" : {
|
"query" : {
|
|
},
|
"indexOnly" : false,
|
"cursorType" : "BasicCursor"
|
}
|
}
|
]
|
}
|
},
|
"ok" : 1
|
}
|
Explain after:
mongos> db.runCommand({aggregate:'foo', explain:true, pipeline: [{$sort: {_id:1}}]})
|
{
|
"splitPipeline" : {
|
"shardsPart" : [
|
{
|
"$sort" : {
|
"sortKey" : {
|
"_id" : 1
|
}
|
}
|
}
|
],
|
"mergerPart" : [
|
{
|
"$sort" : {
|
"sortKey" : {
|
"_id" : 1
|
},
|
"mergePresorted" : true
|
}
|
}
|
]
|
},
|
"shards" : {
|
"shard0000" : {
|
"host" : "localhost:30001",
|
"stages" : [
|
{
|
"$cursor" : {
|
"query" : {
|
|
},
|
"sort" : {
|
"_id" : 1
|
},
|
"indexOnly" : false,
|
"cursorType" : "BtreeCursor _id_"
|
}
|
}
|
]
|
}
|
},
|
"ok" : 1
|
}
|
Branch: master
https://github.com/mongodb/mongo/commit/615357b9f15f6a9104d4a82a21fdbe24e6630201
|