-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.6.0-rc0
-
Component/s: Performance, Querying
-
None
-
ALL
-
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Count queries that can be index only are slower in 2.6 rc0 than in 2.4.9. For a 10M doc collection with an index on c1 I ran these queries. Queries 1,2 can use the PK on _id. Queries 2,3,4,5 can use the index on c1. Queries 6,7 should do a full scan.
1) db.i.find({ _id : { $gt : 4000000 } }).count() 2) db.i.find({ c1 : { $gt : 4000000 } }).count() 3) db.i.find({ c1 : { $gt : 4000000 } }).hint({ c1 : 1 }).count() 4) db.i.find({ c1 : { $gt : 4000000 } }, { _id:0 }).count() 5) db.i.find({ c1 : { $gt : 4000000 } }, { _id:0 }).hint({ c1 : 1 }).count() 6) db.i.find({ c2 : { $gt : 4000000 } }).count() 7) db.i.find({ c2 : { $gt : 4000000 } }, { _id:0 }).count()
I ran the set of queries twice and looked at times for the second run. All data is cached in RAM.
For 2.4.9 the times are ~750 miillis each for the first 5 queries and then ~2.4 seconds for the last 2 queries.
For 2.6 rc0 the times are ~2 seconds each for the first 5 queries and then ~2.9 seconds for the last 2 queries that should do a full scan. The index-only count queries are much slower in 2.6. Tull scan count queries are also slower (2.9 vs 2.4 seconds) but the difference is less significant.
Alas, I can't do find().count().explain()
Sorry for mixing javascript and python, I am new to javascript. I also don't have the latest version of pymongo.