Getting alert message every 15 mins from MongoDB

Query Targeting: Scanned Objects / Returned has gone above 1000. I get this message everyday.
How do I fix it?

Hi @Yash_Khivasara,
Welcome to the community!
You could raise the threshold of the alert, or improve the query otherwise you could add an index suitable for that type of operation.

From the documentation:

Regards

1 Like

Hi @Yash_Khivasara, thanks for submitting your question!

The alert you’re receiving is specifying that the ratio of the documents MongoDB has scanned to the number it has returned is above 1000, which represents an unfavorable ratio. This can be problematic because this means MongoDB is scanning 1000x more documents than it is returning, and can result in performance issues as you scale your query volume or the size of your data.

As Fabio has shared, one easy / interim fix for this issue may be creating an index, which will reduce the number of documents scanned. I recommend checking out our Performance Advisor, which provides index recommendations based on your usage.

More information on the Query Targeting alert can be found on documentation page. And please let us know if you have any additional questions.

1 Like