Wednesday, 25 July 2018

MySQL: Script to find Long Running Queries and Transactions


Don’t you think so that finding Long Running Queries are a very common requirement for a Database Administrator? ‘
Yes, Database Administrators are always looking for a list of Long Running Queries.
In this post, I am sharing scripts to find Long Running Queries or Transactions of MySQL Database Server.
MySQL DBA can use this script to take necessary steps against the bad and long running queries which increase the overall performance of MySQL Database Server.
In below script, I set 59 seconds internal to find long running query since last 59 seconds.
As per your requirement, you can change this value.
Script without using Performance_schema:
Script using Performance_schema:

0 comments:

Post a Comment