I’m wondering if one can optimize read performance (reading the document data) when using compound indexes.
Let’s say we have some relevant fields: date, country and log. But log could be anything else which could be relevant for my query. The document will have a lot more fields, which are not relevant for this query.
While I want to filter by date and country I would create an compound index for date and country.
Since the only information I need is log, does it make sense to make an compound index with date, country and log? I still filter only by date and country, but would this log information inside of the index prevent MongoDB to load the additional field data from the collection itself?
I’m wondering if read operations can be minimized this way. Or, if the index can be used for reading the log data as well, MongoDB still needs additional reads to get this information from the index.