5.5之前。这还不叫change buffer,而是insert buffer

当更新/插入的非聚集索引的数据所对应的页不在内存中时(对非聚集索引的更新操作通常会带来随机IO),会将其放到一个insert buffer中,当随后页面被读到内存中时,会将这些变化的记录merge到页中。当服务器比较空闲时,后台线程也会做merge操作

 

insert buffer会占用buffer pool,并且在非聚集索引很少时,并不总是必要的,反而会降低buffer pooldata cache的能力,5.5提供了参数innodb_change_buffering来对其进行控制

根据官方文档的描述,主要包括以下几个值:

1.all

The default value: buffer inserts, delete-marking operations, and purges.

2.none

Do not buffer any operations.

3.inserts

Buffer insert operations.

4.deletes

Buffer delete-marking operations.(包括deleteupdate操作)

5.changes

Buffer both inserts and delete-marking.

6.purges

Buffer the physical deletion operations that happen in the background