MySQL - enable slow query log
What is slow query log?
Slow queries can affect database and server performance.
The slow query log consists of SQL statements that took more than
long_query_time
seconds to execute.This greatly simplifies the task of finding inefficient or time-consuming queries.
By default, the slow query log is disabled
How to enable?
Login to MySQL, database
abc_prod
Enable slow query log
Check path to log file
Change long query time to 5 seconds - default is 10 seconds
Logout MySQL session then login again
Take a small test to ensure slow query log is enable
Check sleep on slow query log
Most important:
Using mysqldumpslow
tool for summarize slow query log files
How to turn it off?
Last updated