SHOW ENGINE INNODB STATUS
and the InnoDB
Monitors
InnoDB
Monitors provide information about the InnoDB
internal state. This information is useful for performance tuning. Each Monitor can be enabled by creating a table with a special name, which causes InnoDB
to write Monitor output periodically. Also, output for the standard InnoDB
Monitor is available on demand through the SHOW ENGINE INNODB STATUS
SQL statement.
There are several types of InnoDB
Monitors:
- The standard
InnoDB
Monitor displays the following types of information:- Table and record locks held by each active transaction
- Lock waits of a transactions
- Semaphore waits of threads
- Pending file I/O requests
- Buffer pool statistics
- Purge and insert buffer merge activity of the main
InnoDB
thread
For a discussion of
InnoDB
lock modes, see , "InnoDB
Lock Modes".To enable the standard
InnoDB
Monitor for periodic output, create a table namedinnodb_monitor
. To obtain Monitor output on demand, use theSHOW ENGINE INNODB STATUS
SQL statement to fetch the output to your client program. If you are using the mysql interactive client, the output is more readable if you replace the usual semicolon statement terminator with\G
:mysql>
SHOW ENGINE INNODB STATUS\G
- The
InnoDB
Lock Monitor is like the standard Monitor but also provides extensive lock information. To enable this Monitor for periodic output, create a table namedinnodb_lock_monitor
. - The
InnoDB
Tablespace Monitor prints a list of file segments in the shared tablespace and validates the tablespace allocation data structures. To enable this Monitor for periodic output, create a table namedinnodb_tablespace_monitor
. - The
InnoDB
Table Monitor prints the contents of theInnoDB
internal data dictionary. To enable this Monitor for periodic output, create a table namedinnodb_table_monitor
.NoteAs of MariaDB 5.6.3, the
innodb_table_monitor
table is deprecated and will be removed in a future MariaDB release. Similar information can be obtained fromInnoDB
INFORMATION_SCHEMA
tables. See , "INFORMATION_SCHEMA
Tables forInnoDB
".
To enable an InnoDB
Monitor for periodic output, use a CREATE TABLE
statement to create the table associated with the Monitor. For example, to enable the standard InnoDB
Monitor, create the innodb_monitor
table:
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
To stop the Monitor, drop the table:
DROP TABLE innodb_monitor;
The CREATE TABLE
syntax is just a way to pass a command to the InnoDB
engine through MySQL's SQL parser: The only things that matter are the table name innodb_monitor
and that it be an InnoDB
table. The structure of the table is not relevant at all for the InnoDB
Monitor. If you shut down the server, the Monitor does not restart automatically when you restart the server. Drop the Monitor table and issue a new CREATE TABLE
statement to start the Monitor. (This syntax may change in a future release.)
The PROCESS
privilege is required to start or stop the InnoDB
Monitor tables.
When you enable InnoDB
Monitors for periodic output, InnoDB
writes their output to the mysqld server standard error output (stderr
). In this case, no output is sent to clients. When switched on, InnoDB
Monitors print data about every 15 seconds. Server output usually is directed to the error log (see , "The Error Log"). This data is useful in performance tuning. On Windows, start the server from a command prompt in a console window with the --console
option if you want to direct the output to the window rather than to the error log.
InnoDB
sends diagnostic output to stderr
or to files rather than to stdout
or fixed-size memory buffers, to avoid potential buffer overflows. As a side effect, the output of SHOW ENGINE INNODB STATUS
is written to a status file in the MariaDB data directory every fifteen seconds. The name of the file is innodb_status.
, where pid
pid
is the server process ID. InnoDB
removes the file for a normal shutdown. If abnormal shutdowns have occurred, instances of these status files may be present and must be removed manually. Before removing them, you might want to examine them to see whether they contain useful information about the cause of abnormal shutdowns. The innodb_status.
file is created only if the configuration option pid
innodb-status-file=1
is set.
InnoDB
Monitors should be enabled only when you actually want to see Monitor information because output generation does result in some performance decrement. Also, if you enable monitor output by creating the associated table, your error log may become quite large if you forget to remove the table later.
For additional information about InnoDB
monitors, see:
- Mark Leith: InnoDB Table and Tablespace Monitors
Each monitor begins with a header containing a timestamp and the monitor name. For example:
================================================ 090407 12:06:19 INNODB TABLESPACE MONITOR OUTPUT ================================================
The header for the standard Monitor (INNODB MONITOR OUTPUT
) is also used for the Lock Monitor because the latter produces the same output with the addition of extra lock information.
The following sections describe the output for each Monitor.