Mysql – How to know how full the MySQL redo log is

MySQL

Setting innodb_log_file_size to a higher value improves write performance, but increases crash recovery time (or even restart time, if I understand correctly).

Is there a way to know, at any time, how full the redo log is? To get an idea of how long the crash recovery would take.

Subsidiary question: is there a way to force flushing the redo log, while MySQL is running?

Best Answer

The answer depends on which version of MySQL you are using. Meanwhile, here are two 'old' answers:

  • innodb_log_file_size should be at least 10 times the size of the largest BLOB or TEXT being used. (That has been relaxed recently some.)

  • Adjust innodb_log_file_size so the following is roughly 60. This computes how often (in minutes) the log is rotated. Once every 60 minutes is recommended, but if this gives you anywhere between 20 and 180, your setting is probably fine.

      Uptime / 60 * innodb_log_file_size / Innodb_os_log_written
    
  • The recovery time has improved recently. So, again, upgrading may be useful.

Meanwhile, adjust according to the above guidelines.