The Slow Query Log. There is a performance hit taken by enabling the slow query log feature. The slow query log is a record of SQL queries that took a long time to perform.
This greatly simplifies the task of finding inefficient or time-consuming queries. 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. Set global log_slow_queries 1.
However in order to determine which queries require most urgent attention it is an advantage to summarize the slow query log.
Set global slow_query_log_file. Slow_query_log 1 slow_query_log_file slow-querylog long_query_time 2. The slow query log records all of the queries that are fulfills the criteria specified by the slow query log settings. If a query takes longer than the value specified this query will be recorded in the slow query log file.