My mongodb is pretty simple: a dataset / record has about 30 properties on three levels. One such entry has about 5,000 characters. I have 500 thousand of them. When I execute the following request ...
db.images.find({ "featureData.cedd": { $exists: false}}).count()
... he is very slow. It is not indexed, but still ... from my MySQL experience, it doesn't take 20 minutes to execute one such query.
When executed (directly on the mongo terminal), 3% of the CPU is used and another 2 GB of free memory.
Thanks for giving me a clue what I can do!
EDIT: Explanation () of the request (excluding) gives:
db.images.find({ "featureData.cedd": { $exists: false }}).explain() { "cursor" : "BasicCursor", "nscanned" : 532537, "nscannedObjects" : 532537, "n" : 438, "millis" : 1170403, "nYields" : 0, "nChunkSkips" : 0, "isMultiKey" : false, "indexOnly" : false, "indexBounds" : { } }
Output signal iostat:
Linux 3.2.0-58-generic (campartex) 03/25/2014 _x86_64_ (2 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 34.93 0.01 0.25 0.48 0.00 64.33 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sda 2.08 103.79 11.26 172805914 18749067 fd0 0.00 0.00 0.00 148 0
Explanation () output after adding index :
db.images.find({ "featureData.cedd": { $exists: false }}).explain() { "cursor" : "BtreeCursor featureData.cedd_1", "nscanned" : 438, "nscannedObjects" : 438, "n" : 438, "millis" : 2, "nYields" : 0, "nChunkSkips" : 0, "isMultiKey" : true, "indexOnly" : false, "indexBounds" : { "featureData.cedd" : [ [ null, null ] ] } }