Slow Query Operation

We are using a mongo db replica set and facing the issue with slow query. Our db size is increasing day by day and because of that when the we run the query it’s taking a time. We have increased the CPU ,Ram and Storage but still its taking time to find the query from the bulk database.

Please help

Hi @pankaj_thapliyal - welcome to the forums!

This could be the result of a number of different factors and I think the question would get more assistance in the “Working with Data” category as it sounds like this is not directly related to a problem or issue with the M312 course.

In terms of learning about your slow query, you can download Compass and use it to analyse the query plan (see this docs page on how to do this). This might help highlight if you need an index or if you might need a different better index to support your query.

In M312, Chapter 3 is entirely focused on identifying slow queries and I would recommend that you follow this chapter and use the mtools package with your log files as this will definitely provide you with further details on the slow query.

I would also recommend Chapter 5 in M312 as this deals with poor schema design as the symptoms you outline indicate this could equally be an issue.

If you are running Atlas with a support plan, you might want to consider Flex Consulting as this would allow you to work with our Professional Services team to identify any query problems in your application and for them to provide you with solutions.

Hope this helps and kindest regards,
Eoin

2 Likes