Kill queries from specific AppName that runs longer than X minutes
Hello,
I have some users that are not so technical, but connect to the database regularly to extract some data.
However, sometimes they write really bad queries, or search for keys that don't exist in any document, leading to a client timeout -- however, the query continues running in the database backend for minutes. Sometimes for more than 10 minutes.
And almost everytime the users tend to insist on resubmitting the same query because the client timed out, leading to a few executions of the same query for the same amount of time..
I was thinking of a configuring some kind of kill switch for queries that run longer than X minutes, and are originated from specific appNames, for example mongoDB Compass
I am trying to avoid using maxTimeMS() as it's a global trigger, and I don't want to affect backend processes that are OK to have longer execution times, like heavy reporting and scheduled cronjobs.