Fluid Hosting 28 Mar 2017 
HomeServicesSupportContact UsAbout UsForums |
Support Center » Knowledgebase » Slow Query Logging in MySQL
 Slow Query Logging in MySQL
Solution One of the built-in tools in MySQL that you can use in optimizing your database is the "slow-query-logging" feature. This feature allows you to log slow running queries to a log file. By default, this feature is not enabled on your VPS and you will need to add a couple of lines in your "/etc/my.cnf" file (in the [mysqld] section) which I have stated below:

log-slow-queries = /var/log/mysql-slow.log
long_query_time = 5

The statements above will log queries taking longer than five second to the specified log file (/var/log/mysql-slow.log). Once finished editing your my.cnf file, restart MySQL by executing the command below:

service mysqld restart

Article Details
Article ID: 295
Created On: 12 Mar 2007 08:32 PM

 This answer was helpful  This answer was not helpful

 Login [Lost Password] 
Remember Me:
 Article Options
Home | Submit a Ticket | Knowledgebase | News | Downloads

Help Desk Software Help Desk Software By Kayako SupportSuite v3.60.04