How to determine Indexes in RAM

Hi All,

We are currently doing performance testing to help size our servers and possibly to make changes to our Mongo configuration. We have been trying to develop query time statistics that show the average query time for indexes that are currently stored in RAM vs query times coming from indexes fetched from HDDs. We are able to gather executionTimeMillis using the .explain() function. This function is also supposed to provide an ‘alreadyHasObj’ parameter to tell us whether or not the indexes were scanned in RAM or not, but this parameter is always 0 and does not seem to be working.

I have seen that prior to v3.0, there was a serverStatus command that provided indexCounters that allowed people to figure out this information. However this functionality seems to have been depricated.

We are currently running Mongo v3.4. Does anyone know if this serverStatus indexCounters functionality has been replaced? If not is there a way for us to gather this data using Mongo 3.4?

Any and all help is appreciated, thank you!

Hi @Tim_Thomas welcome to the community!

First of all, please be aware that MongoDB 3.4 series are out of support since [January 2020]MongoDB Legacy Support Policy | MongoDB) so you might want to consider moving up to a supported version (4.2 and newer at this point).

To get started with, you might want to have a look at Analyze Query Performance and Ensure Indexes Fit in RAM. The latter link is for MongoDB 5.0, but the concept is still relevant. MongoDB 3.2 and newer also have the $indexStats aggregation stage that shows various information about index usage.

Best regards

1 Like