Creates a report of the current server status for diagnostic purposes.
This procedure was added in MySQL 5.7.9. For MySQL 5.6, it requires MySQL 5.6.10 or higher. For MySQL 5.7, it requires MySQL 5.7.9 or higher.
Data collected for
includes this information:
Information from other relevant
sysschema views, such as the one that detemines queries in the 95th percentile
Information from the
ndbinfoschema, if the MySQL server is part of NDB Cluster
Replication status (both master and slave)
Some of the sys schema views are calculated as initial (optional), overall, and delta values:
The initial view is the content of the view at the start of the
diagnostics()procedure. This output is the same as the start values used for the delta view. The initial view is included if the
diagnostics.include_rawconfiguration option is
The overall view is the content of the view at the end of the
diagnostics()procedure. This output is the same as the end values used for the delta view. The overall view is always included.
The delta view is the difference from the beginning to the end of procedure execution. The minimum and maximum values are the minimum and maximum values from the end view, respectively. They do not necessarily reflect the minimum and maximum values in the monitored period. Except for the
metricsview, the delta is calculated only between the first and last outputs.
in_max_runtime INT UNSIGNED: The maximum data collection time in seconds. Use
NULLto collect data for the default of 60 seconds. Otherwise, use a value greater than 0.
in_interval INT UNSIGNED: The sleep time between data collections in seconds. Use
NULLto sleep for the default of 30 seconds. Otherwise, use a value greater than 0.
in_auto_config ENUM('current', 'medium', 'full'): The Performance Schema configuration to use. Permitted values are:
current: Use the current instrument and consumer settings.
medium: Enable some instruments and consumers.
full: Enable all instruments and consumers.
The more instruments and consumers enabled, the more impact on MySQL server performance. Be careful with the
mediumsetting and especially the
fullsetting, which has a large performance impact.
Use of the
fullsetting requires the
If a setting other than
currentis chosen, the current settings are restored at the end of the procedure.
If this option is
ON, produce debugging output. The default is
The maximum length of statements returned by the
format_statement()function. Longer statements are truncated to this length. The default is 64.
Create a diagnostics report that starts an iteration every 30 seconds and runs for at most 120 seconds using the current Performance Schema settings:
CALL diagnostics(120, 30, 'current');
CALL diagnostics(120, 30, 'current');mysql>