I need to trace out what are happening on mysql when my application is running.
This is extremely useful for finding the lengthy sql query. This would help us to get an idea about which queries are to be taken for optimization which will cause the mysql performance.
This technique will work only the latest version of Mysql Say 5.3.1 or later.
login to mysql console,then execute
This command will generate a file on your mysql data directory and increasing very rapidly depending on the sql executed. Pls use it only for tracing/analyzing the issues only and turn off it once checking is finished. This command will turn off this loggingSET GLOBAL general_log = 'Off';
Enabling the slow query log
long_query_time = 0
slow_query_log = 1
#touch /var/log/slowlog.query.log && chown -R mysql.mysql /var/log/slowlog.query.log