-
Type: Question
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Index Maintenance
-
None
We have a collection (called childData) with the following indexes:
m_childDataCollection.CreateIndex(IndexKeys.Ascending(MongoChildData.ItemIdProperty).Ascending(MongoChildData.ChildIdProperty)); m_childDataCollection.CreateIndex(IndexKeys.Ascending(MongoChildData.RedundantTimeProperty));
This query runs very fast (less than a second) and returns 59631 :
db.childdata.find(\{ ItemId: ObjectId('596f322ba28f4b1240f1c2e9') }).count()
This query takes around 15 minutes:
db.childdata.find(\{ ItemId: ObjectId('596f322ba28f4b1240f1c2e9') }, \{ItemId : 1, ChId : 1}).toArray()
We are failing to understand why this second query takes so long even though it is using the index?
Please note that I have also rebuilt these indexes completely. It took over 3 days to do this!
Thanks
Ian