设置合适的 InnoDB 日志文件大小的计算方法

做下笔记,简单记录一下,InnoDB日志文件太大,会影响MYSQL奔溃恢复的时间,太小会增加IO负担
参考:http://www.mysqlperformanceblog.com/2008/11/21/how-to-calculate-a-good-innodb-log-file-size/


mysql> pager grep sequence
PAGER SET TO 'grep sequence'
mysql> SHOW engine innodb STATUS\G SELECT sleep(60); SHOW engine innodb STATUS\G
Log sequence number 84 3836410803
1 row IN SET (0.06 sec)
 
1 row IN SET (1 min 0.00 sec)
 
Log sequence number 84 3838334638
1 row IN SET (0.05 sec)
mysql> SELECT (3838334638 - 3836410803) / 1024 / 1024 AS MB_per_min;
+------------+
| MB_per_min |
+------------+
| 1.83471203 |
+------------+



这样就可以得到每分钟的大小,乘以60,越等于64MB,所以innodb_log_file_size=64M

你可能感兴趣的:(sql,mysql)