Setting correct innodb_log_file_size in mysql

前端 未结 1 1654
夕颜
夕颜 2021-02-04 10:24

We ran an alter table today today that took down the DB. We failed over to the slave, and in the post-mortem, we discovered this in the mysql error.log

<         


        
相关标签:
1条回答
  • 2021-02-04 10:37

    0. Preliminary information

    Your settings:

    innodb_log_file_size = 50331648
    innodb_log_files_in_group = 2
    

    Therefore your "log group capacity" = 2 x 50331648 = 96 MB

    1. How to determine the largest row

    There is no direct method. But one can easily calculate the size of one given row based on these tables (compression should not matter to us here, if, as I assume, rows are not compressed in the log files).

    2. Impact of innodb_log_file_size

    Reference manual:

    The larger the value, the less checkpoint flush activity is needed in the buffer pool, saving disk I/O. Larger log files also make crash recovery slower, although improvements to recovery performance in MySQL 5.5 and higher make the log file size less of a consideration.

    3. Anything else to worry about

    6169.8 GB / 650k rows = about 10 MB per row on average This is a serious problem per se if you intend to use your database in a transactional, multi-user situation. Consider storing your BLOB's as files outside of the database. Or, at least, store them in a separate MyISAM (non-transactional) table.

    0 讨论(0)
提交回复
热议问题