日志缓冲区是用于保存将写入磁盘日志文件的数据的内存区域。日志缓冲区的大小由 innodb_log_buffer_size 变量定义。默认大小为 64MB。日志缓冲区的内容会定期刷新到磁盘。较大的日志缓冲区允许大型事务运行而无需在事务提交之前将重做日志数据写入磁盘。因此,如果您有更新、插入或删除大量行的事务,增加日志缓冲区的大小可以节省磁盘 I/O。The log buffer is the memory area that holds data to be written to
the log files on disk. Log buffer size is defined by the
innodb_log_buffer_size variable.
The default size is 64MB. The contents of the log buffer are
periodically flushed to disk. A large log buffer enables large
transactions to run without the need to write redo log data to
disk before the transactions commit. Thus, if you have
transactions that update, insert, or delete many rows, increasing
the size of the log buffer saves disk I/O.
innodb_flush_log_at_trx_commit 变量控制日志缓冲区的内容如何写入并刷新到磁盘。innodb_flush_log_at_timeout 变量控制日志刷新频率。The
innodb_flush_log_at_trx_commit
variable controls how the contents of the log buffer are written
and flushed to disk. The
innodb_flush_log_at_timeout
variable controls log flushing frequency.
有关相关信息,请参见 内存配置,以及 第 10.5.4 节,“优化 InnoDB 重做日志”。For related information, see Memory Configuration, and Section 10.5.4, “Optimizing InnoDB Redo Logging”.