Enabling the slow query log
From Shrubbery
Enablilng the slow query log on Linux:
- Edit /etc/my.cnf, add:
# log-slow-queries=/var/log/mysqld-slow-queries.log
log-queries-not-using-indexes - Create the log file for the mysql user:
# touch /var/log/mysqld-slow-queries.log
# chown mysql:mysql /var/log/mysqld-slow-queries.log - Restart MySQL:
# service mysqld restart
Take queries out of the slow query log and analyze them using EXPLAIN
See:

