~ $ mysqldumpslow -a /var/lib/mysql/slowquery.log To make reading the log contents easier, you can use the mysqldumpslow command-line utility to process a slow query log file and summarize its contents: Here is what a typical entry in the slow log file might look like: In the Server Monitor, click on the middle Variables tab and scroll down to see the slow_query_log and slow_query_log_file server variables in the list: Reading the Slow Query LogĮxamining a long slow query log can be a time-consuming task due to the huge amount of content to sift through. It's accessible via the Tools main menu command. In Navicat, you can access system variables using the Server Monitor tool. Likewise, an argument of 0 (OFF in Navicat) disables the log. Likewise, providing no argument also turns on the slow query log. You can turn it on by setting the -slow_query_log variable to 1 (ON in Navicat). The slow query log is disabled by default so as to save disk space. Hence, queries that appear in the slow query log are those that take a substantial time to execute and are thusly candidates for optimization. The slow query log consists of SQL statements that take more than long_query_time seconds to execute and require at least min_examined_row_limit rows to be examined. This blog will describe how to read and interpret slow query log output to better debug query performance. Of these, the slow query log is especially useful for finding inefficient or time-consuming queries, which can adversely affect database and overall server performance. MySQL provides several different log files that can help you find out what's going on inside your MySQL server instance. Working With the MySQL Slow Query Log by Robert Gravelle
0 Comments
Leave a Reply. |