Saturday, March 1, 2008

To find out slow queries running for mysql

Sometimes php applications are not tuned up properly. In that case we can track the mysql queries running at very slow speed.

To do this
Edit /etc/init.d/mysql

$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 &

Add --log-slow-queries=/var/log/slow-queries.log to above line as below.


$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file --log-slow-queries=/var/log/slow-queries.log
>/dev/null 2>&1 &

No comments: