Google Translate

Valutazione attuale: 0 / 5

Stella inattivaStella inattivaStella inattivaStella inattivaStella inattiva
 

If you need to know which queries require long time, you can activate the mysql log for slow queries.

To activate we need to edit the config file. On ubuntou you can use

nano /etc/mysql/my.cnf

# Log
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2

 MySQL needs to be restarted. On ubuntu you can try

restart mysql

 The log file will be created when mysql matches a long query with the time specified.

There is a tool to extract from the log file. Try the following

mysqldumpslow /var/log/mysql/mysql-slow.log -s c -t 10

 Or use the classic tail to see live new entries.

tail -f /var/log/mysql/mysql-slow.log

 

- have fun -