We have set timeout for long running query in the application to 2 minutes. In other words, if a query is running over 2 minutes, the application will terminate the process of the query automatically.

We would like to set the same standard in the database. How and what can we set such that when a particular query is running over 2 minutes, it will be terminated so that the long-running query won't take up so much resource and affect other users in the system?