[SERVER-796] Distinct is slow Created: 19/Mar/10  Updated: 12/Jul/16  Resolved: 29/Mar/10

Status: Closed
Project: Core Server
Component/s: Performance
Affects Version/s: None
Fix Version/s: 1.5.0

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-797 better way to generate clientcursor Closed
Participants:

 Description   

> db.people.distinct('city',

{state:'NY'}

).length
1371
> Date.timeFunc(function(){db.people.distinct('city',

{state:'NY'}

)})
14369
> db.people.find(

{state:'NY'}

).explain().millis
1338

db.people.find(

{state:'NY'}

).explain()
{
"cursor" : "BtreeCursor state_1_city_1",
"indexBounds" : [
[
{
"state" : "NY",
"city" :

{ "$minElement" : 1 }

},
{
"state" : "NY",
"city" :

{ "$maxElement" : 1 }

}
]
],
"nscanned" : 1980644,
"nscannedObjects" : 1980644,
"n" : 1980644,
"millis" : 1365,
"oldPlan" : {
"cursor" : "BtreeCursor state_1_city_1",
"indexBounds" : [
[
{
"state" : "NY",
"city" :

{ "$minElement" : 1 }

},
{
"state" : "NY",
"city" :

{ "$maxElement" : 1 }

}
]
]
},
"allPlans" : [
{
"cursor" : "BtreeCursor state_1_city_1",
"indexBounds" : [
[
{
"state" : "NY",
"city" :

{ "$minElement" : 1 }

},
{
"state" : "NY",
"city" :

{ "$maxElement" : 1 }

}
]
]
}
]
}



 Comments   
Comment by Eliot Horowitz (Inactive) [ 26/Apr/10 ]

in a release

Comment by Eliot Horowitz (Inactive) [ 29/Mar/10 ]

http://buildbot.mongodb.org/builders/OS%20X%2010.5%2064-bit/builds/563/steps/test/logs/stdio

Comment by auto [ 29/Mar/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: faster distinct SERVER-796
http://github.com/mongodb/mongo/commit/5b5d73a6529b95e47033e40dcebee01d9417ff7f

Comment by auto [ 29/Mar/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: make distrinct 50% faster - still need cursor change for another 2x improvement SERVER-796
http://github.com/mongodb/mongo/commit/45f8d675d3dde087c0e171089aea319e223216d2

Generated at Thu Feb 08 02:55:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.