InnoDB Logs
InnoDB's redo log ensures durability (crash recovery). The undo log supports ROLLBACK and MVCC. Understanding them helps tune performance.
InnoDB's redo log ensures durability (crash recovery). The undo log supports ROLLBACK and MVCC. Understanding them helps tune performance.
-- 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;
Long open transactions accumulate undo history and can cause performance degradation — commit frequently.