MySQL Slow Queries Test

In general, as applications scale in size, queries to the database server that were once extremely fast can become quite slow. When you are debugging a MySQL database server instance for performance issues, the slow query log comes in handy to figure out which queries are the slowest and how often they are slow.

A query is deemed to be slow and is logged in the slow query log if that query exceeds a given threshold of execution time. By default, all queries taking longer than 10 seconds are logged. If the queries are repeatedly logged in the slow query log, then, the size of the log may grow rapidly leading to an impact on the performance of the database server instance. To improve the performance of the database server instance, it is necessary for the administrators to identify the slow queries and optimize them at the earliest. The MySQL Slow Queries test helps administrators to proactively track such abnormalities in the slow query log and optimize the queries before end users start complaining.

This test periodically monitors the slow query log of the target database server and reports whether/not the slow query log is enabled. This test also reports the total file size of the slow query log and the growth rate of the log file. Using this test, administrators can quickly determine abnormal growth patterns of the slow query log and identify those slow queries that are candidates for optimization.

Target of the test : A MySQL server

Agent deploying the test : An internal/remote agent

Outputs of the test : One set of results for the target database server instance being monitored

Configurable parameters for the test
Parameter Description

Test Period

How often should the test be executed.

Host

The IP address of the MySQL server.

Port

The port at which the specified host listens.

Database

Specify the name of a database on the target MySQL database server being monitored

Username and Password

The eG agent has to be configured with the credentials of a user who has server-wide Process and Select privileges on the monitored MySQL server. To know how to create such a user, refer to Pre-requisites for Monitoring the MySQL Server topic.

Confirm Password

Confirm the password by retyping it here.

Slow Query Time

In the Slow Query Time text box, specify the duration (in seconds) beyond which a query (logged in slow query log) should have executed for it to be considered as a slow query by this test. The default value is 10 seconds.

Detailed Diagnosis

To make diagnosis more efficient and accurate, the eG Enterprise embeds an optional detailed diagnostic capability. With this capability, the eG agents can be configured to run detailed, more elaborate tests as and when specific problems are detected. To enable the detailed diagnosis capability of this test for a particular server, choose the On option. To disable the capability, click on the Off option.

The option to selectively enable/disable the detailed diagnosis capability will be available only if the following conditions are fulfilled:

  • The eG manager license should allow the detailed diagnosis capability
  • Both the normal and abnormal frequencies configured for the detailed diagnosis measures should not be 0.
Measurements made by the test
Measurement Description Measurement Unit Interpretation

Is logging enabled?

Indicates whether/not the slow query log is enabled.

Number

The values reported by this measure and its numeric equivalents are mentioned in the table below:

Measure Value Numeric Value
Yes 1
No 0

Note:

By default, this measure reports the Measure Values listed in the table above to indicate whether/not the general query log is enabled. The graph of this measure however, is represented using the numeric equivalents only i.e., 0 or 1.

File size

Indicates the current size of the slow query log.

MB

 

Growth rate

Indicates the rate at which the slow query log file had grown during the last measurement period.

MB/sec

A high value for this measure or a consistent increase in its value indicates that the slow query log is rapidly growing and may end up occupying too much space on the disk.

Slow queries

Indicates the number of queries that have been executing for more time than the value configured against the Slow Query Time parameter.

Number

The detailed diagnosis for this measure indicates the exact queries and which user is executing the queries. This information can be very useful in identifying queries that may be candidates for optimization.