I'm running a query that returns a lot of data. It looks up 916 documents, each of them having a large data field (around 5MB). The query looks like this:
db.collection.find(
{'name': somename, 'currency': mycurrency,
'valuation_date': {'$in': [list_of_250_datetime_datetime]}
}.{'data_column: is set to true or false in the below test results}).limit(x)
I have been trying to optimize the query and found out that most of the time is spent loading (or transmitting) that large data item, rather than look it up in the 5GB database. So I assume the query is propery optimized and the indices are used correctly, which is also confirmed by the profiler.
So I assumed that loading the data from disk would take most of the time, but it seems that when I use the in memory storage engine, things are actually slowed down. How is this possible? And what else can I do to speed things up?
In Memory storage engine:
================ Starting test using mongodb://localhost:27018/ ================
Looking up 100 values excluding data column...
++++++++++ Query completed in 0.0130000114441 seconds ++++++++++
Looking up 100 values, full json with data...
++++++++++ Query completed in 2.85100007057 seconds ++++++++++
Looking up all values, excluding data column...
++++++++++ Query completed in 0.0999999046326 seconds for 916 items ++++++++++
Looking up all values, full json with data...
++++++++++ Query completed in 29.2250001431 seconds for 916 items ++++++++++
Wired tiger:
================ Starting test using mongodb://localhost:27017/ ================
Looking up 100 values excluding mdo column...
++++++++++ Query completed in 0.0120000839233 seconds ++++++++++
Looking up 100 values, full json with data...
++++++++++ Query completed in 2.97799992561 seconds ++++++++++
Looking up all values, excluding data column...
++++++++++ Query completed in 0.0700001716614 seconds for 916 items ++++++++++
Looking up all values, full json with data...
++++++++++ Query completed in 23.8389999866 seconds for 916 items ++++++++++