-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Milestone
Description
Range searches perform slow even if the index is created for those searches. I tried range query using the example code from Indices & Performance doc chapter:
var db = new ForerunnerDB(),
names = ['Jim', 'Bob', 'Bill', 'Max', 'Jane', 'Kim', 'Sally', 'Sam'],
collection = db.collection('test'),
tempName,
tempAge,
i;
for (i = 0; i < 100000; i++) {
tempName = names[Math.ceil(Math.random() * names.length) - 1];
tempAge = Math.ceil(Math.random() * 100);
collection.insert({
name: tempName,
age: tempAge
});
}
collection.ensureIndex({
age: 1
});
var explained = collection.explain({
age: {
'$gte': 30,
'$lte': 40
}
});
'Explained' object has tableScan: 100000 as if no index is used.