How to check innodb history list length?

Posted on

Question :

The output for show engine innodb status has the history list length as a number, but that output is hard to parse, and there’s just too much data when all you want is a single value. Is the value available somewhere else that can be fetched as a row?

Answer :

I can’t find documentation confirming it anywhere, but I think it’s:

select count from information_schema.innodb_metrics where name = 'trx_rseg_history_len';

The closest thing to a confirmation is a bug report referring to this counter as the history list length. Also, the current, min and max values match the logs I have recorded. It would be nice if someone familiar with the MySQL source code could confirm it.

Depends on what version you have. Here is the STATUS value:

Innodb_history_list_length

Description: History list length as shown in the TRANSACTIONS
    section of the SHOW ENGINE INNODB STATUS output.
Scope: Global
Data Type: numeric
Introduced: MariaDB 5.5 / XtraDB 5.5.8-20 

(quoted from:) https://mariadb.com/kb/en/mariadb/xtradbinnodb-server-status-variables/#innodb_history_list_length

So I would expect the ‘fetch’ to look like

SELECT VARIABLE_VALUE
     FROM information_schema.GLOBAL_STATUS
     WHERE VARIABLE_NAME = 'Innodb_history_list_length'; 

Leave a Reply

Your email address will not be published. Required fields are marked *