As described in http://bit.ly/bURxwn
> db.hits.findOne()
{ "_id":ObjectId("4ba5a0409a59dc523d0a81dc"),
"date": 1510,
"user": 21176417,
"word": 1,
"list": [994953325, 2000523166]
}
> db.hits.count()
8663354
> print(db.hits.totalIndexSize())
1279240064
> db.hits.find({d: {$gte:1500, $lte:1510}, w: {$in:[275, 317]} }).explain()
{
"cursor" : "BtreeCursor d_1_w_1_u_1",
"startKey" : {
"d" : 1500,
"w" : 275,
"u" :
},
"endKey" : {
"d" : 1510,
"w" : 317,
"u" :
},
"nscanned" : 2866468,
"n" : 5033,
"millis" : 44465,
"allPlans" : [
{
"cursor" : "BtreeCursor d_1_w_1_u_1",
"startKey" : {
"d" : 1500,
"w" : 275,
"u" :
},
"endKey" : {
"d" : 1510,
"w" : 317,
"u" :
}
},
{
"cursor" : "BasicCursor",
"startKey" : {
},
"endKey" : {
}
}
]
}
Eliot replies: right now its not looking all all the sub-regions, just going from the front to back we can optimize at some point
- depends on
-
SERVER-371 optimize compound index multiple ranges
- Closed
-
SERVER-1026 check $in speed
- Closed