Search code examples
mysqlsql-updatebinlog

MySql:If i set binlog format to row,dose change buffer still valid?


When i use "satement" binlog and non-unique index,mysql will use "change buffer" avoid reading from disk. But if set binlog format to "row", binlog need the all columns in the row , so mysql must read from disk.So in this case , dose "change buffer" is invalid?


Solution

  • Base on mysql doc:

    The change buffer is a special data structure that caches changes to secondary index pages when those pages are not in the buffer pool. The buffered changes, which may result from INSERT, UPDATE, or DELETE operations (DML), are merged later when the pages are loaded into the buffer pool by other read operations.

    This doc had made it very clear that change buffer could be used for non-unique secondary index.

    Back to binlog of row format, it wouldn't affect change buffer. Because for insert, update, and delete, though binlog need the all columns in the row, those data could be gotten from cluster index and all non-unique indexes could still benefit from change buffer.


    Implementation:

    change buffer is used to avoid too many random disk read. redo log is used to avoid too many random disk write.