1. Create a simple InnoDB  table: 

mysql> USE test; Database changed mysql> CREATE TABLE t1 (c1 INT) ENGINE=INNODB; Query OK, 0 rows affected (0.02 sec) 

2. Enable the dml_inserts  counter. 

mysql> SET GLOBAL innodb_monitor_enable = dml_inserts; Query OK, 0 rows affected (0.01 sec) 

A description of the dml_inserts  counter can be found in the COMMENT  column of the INNODB_METRICS  table: 

mysql> SELECT NAME, COMMENT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"; +-------------+-------------------------+ | NAME | COMMENT | +-------------+-------------------------+ | dml_inserts | Number of rows inserted | +-------------+-------------------------+ 

3. Query the INNODB_METRICS  table for the dml_inserts  counter data. Because no DML operations have been performed, the counter values are zero or NULL. The TIME_ENABLED  and TIME_ELAPSED values indicate when the counter was last enabled and how many seconds have elapsed since that time. 

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts" \G *************************** 1. row *************************** NAME: dml_inserts SUBSYSTEM: dml COUNT: 0 MAX_COUNT: 0 MIN_COUNT: NULL AVG_COUNT: 0 COUNT_RESET: 0 MAX_COUNT_RESET: 0 MIN_COUNT_RESET: NULL AVG_COUNT_RESET: NULL TIME_ENABLED: 2014-12-04 14:18:28 TIME_DISABLED: NULL TIME_ELAPSED: 28 TIME_RESET: NULL STATUS: enabled TYPE: status_counter COMMENT: Number of rows inserted 

4. Insert three rows of data into the table. 

mysql> INSERT INTO t1 values(1); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 values(2); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 values(3); Query OK, 1 row affected (0.00 sec) 

5. Query the INNODB_METRICS  table again for the dml_inserts  counter data. A number of counter values have now incremented including COUNT , MAX_COUNT , AVG_COUNT , and COUNT_RESET . Refer to the INNODB_METRICS  table definition for descriptions of these values. 

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G 

3327 

