Query Targeting: Scanned Objects / Returned has gone above 1000

Hello Team,

Recently in our production environment we are getting the following alert “Query Targeting: Scanned Objects / Returned has gone above 1000” continuously at least twice a week but when our team checks the profiler during the time of alert all the queries execution time was not more than 50ms and also all the queries which were running during the time of alert was insert queries.
Even in performance advisor I didn’t get any suggestion to add new index based on the generated alerts. Can you please help me with this since it is production platform we are worried about this alert

Hi @Vignesh_Ramesh,

Welcome to MongoDB community.

I think the best for you to contact our Atlas support to look into your production specific workload.

High query targeting usually indicate on suboptimal queries as more documents are scanned vs returned. However, if you don’t see ant impact in actual performance this alert might not be critical for you and you may ignore it or tune the threshold to fit your monitoring needs.

Thanks
Pavel

1 Like

How I can tune it so that it works properly? via indexing?

@Chris_Heffernan Usually yes, but it depends on the specific env.

Look into performance advisor to see if anything is suggested.

Any ideas if index creation will send Query Targeting: Scanned Objects / Returned alert?

Thanks!

NOTE

It is possible to receive a Query Targeting alert for an inefficient query without receiving index suggestions from the Performance Advisor if the query exceeds the slow query threshold and the ratio of scanned to returned documents is greater than the threshold specified in the alert.

I see the above Note from the below link:
Fix Query Issues — MongoDB Atlas

We are getting slammed with the above alerts without Index creation recommendations.

Thanks
Kothan.