- 
    Type:Improvement 
- 
    Resolution: Duplicate
- 
    Priority:Major - P3 
- 
    None
- 
    Affects Version/s: 1.6.5
- 
    Component/s: Querying
- 
    None
- 
    Environment:Any
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
Using the test script below this script reports about 50ms of time taken for the count query in the script. This is way too slow for a query that the query optimizer should resolve to a direct bsearch on the index, or so I assume.
use test
db.values.drop();
db.values.ensureIndex(
);
for (var i = 1; i <= 100000; i++) db.values.save(
{value : i});
var t1 = new Date().getTime();
db.values.count({value:{$gt:5000}});
var t2 = new Date().getTime();
(t2 - t1);
- duplicates
- 
                    SERVER-1752 improve the performance of simple counts -         
- Closed
 
-         
- is related to
- 
                    SERVER-3268 Attempting to count() a date query causes cursor to timeout -         
- Closed
 
-