Skip to main content

Posts

Showing posts from July, 2018

MySQL: Analyzing the slow query log

Analyzing the slow query log We need to analyze the slow query log in order to identify the queries that impact a system. It does not always have to be the slowest queries that do this, because queries running more frequently with lower execution time (for example, a query that takes 1 seconds to run but runs thousands of times per minute) increase the workload on a system more than really slow queries running with less frequency (for example, a query that takes 60 seconds to run once a month). Really slow queries impact the system throughput, but queries running frequently generate most of the system workload. Eventually, the slow query log grows in size, and the size is too big to analyze by simple inspection. In order to get a big picture on slow queries, MySQL provides a tool named  mysqldumpslow  to display the results in a way that’s easy to analyze. To use this tool, we need to pass the  slow query log  as the parameter, as shown in listing 09. $ my...