SyntaxStudy
Sign Up
MySQL InnoDB Redo and Undo Logs
MySQL Advanced 5 min read

InnoDB Redo and Undo Logs

InnoDB Logs

InnoDB's redo log ensures durability (crash recovery). The undo log supports ROLLBACK and MVCC. Understanding them helps tune performance.

Example
-- Redo log variables
SHOW VARIABLES LIKE "innodb_log%";
-- innodb_log_file_size: larger = more write buffer, slower recovery
-- innodb_log_files_in_group: default 2
-- Undo log
SHOW VARIABLES LIKE "innodb_undo%";
-- Long-running transactions bloat the undo log
-- Check for long transactions:
SELECT * FROM information_schema.INNODB_TRX WHERE TIME_TO_SEC(TIMEDIFF(NOW(), trx_started)) > 60;
Pro Tip

Long open transactions accumulate undo history and can cause performance degradation — commit frequently.