Tuesday, April 10, 2012

Profile slow mysql queries

Edit /etc/my.cnf

Add the following to [mysqld] section:

log-slow-queries
long_query_time = 1

sudo /sbin/service mysqld restart

Generate load.

There will be a slow query log in the mysql data dir.  The mysql data dir can be found by performing the following query:

show variables like 'datadir';

Thanks, http://hackmysql.com/nontech

No comments: