The DB Monitor extension will give admins a notification bubble if any of CiviCRM's database queries is taking a very long time, and gives you the options to stop (i.e. "kill") it. Use this with caution.
You can also set up a scheduled job to "monitor" the system for such long-running queries and drop you an email if one is detected.