没听懂innodb_fulsh_log_at_trx_commit 值为0和2的区别是啥

来源:5-2 MySQL配置文件优化

英宁

2016-02-20 10:17

好像都是一秒以后刷新到磁盘,是2会先刷到缓存里么,那0的时候一秒以后直接刷磁盘?

写回答 关注

2回答

  • 大老唐
    2016-12-21 21:16:41
    已采纳

    0和2都是每秒从缓冲区写入文件一次。区别是commit操作时,0不做任何操作,为2 的时候,commit时会把缓冲区内容写入文件。文档上是这么写的:If the value of innodb_flush_log_at_trx_commit is 0, the log buffer is written out to the log file once per second and the flush to disk operation is performed on the log file, but nothing is done at a transaction commit.. When the value is 2, the log buffer is written out to the file at each commit, but the flush to disk operation is not performed on it. However, the flushing on the log file takes place once per second also when the value is 2.

    英宁

    非常感谢!

    2017-03-21 17:12:41

    共 1 条回复 >

  • 拿拿斯
    2016-02-23 15:53:46

    0是每秒刷一次磁盘,1是每一个事务提交后都要刷一次磁盘,2是提交事务后记录但是不刷盘。

性能优化之MySQL优化

了解MySQL数据库优化的方法和技巧,在课程中共同探讨一起学习吧

101664 学习 · 221 问题

查看课程

相似问题