在线 DDL 操作在创建或重建二级索引的不同阶段会分配临时缓冲区。innodb_ddl_buffer_size 变量定义了在线 DDL 操作的最大缓冲区大小。默认设置为 1048576 字节(1 MB)。该设置适用于执行在线 DDL 操作的线程创建的缓冲区。定义适当的缓冲区大小限制可以避免在创建或重建二级索引的在线 DDL 操作中可能出现的内存不足错误。每个 DDL 线程的最大缓冲区大小为最大缓冲区大小除以 DDL 线程数(innodb_ddl_buffer_size/innodb_ddl_threads)。Online DDL operations that create or rebuild secondary indexes
allocate temporary buffers during different phases of index
creation. The
innodb_ddl_buffer_size variable
defines the maximum buffer size for online DDL operations. The
default setting is 1048576 bytes (1 MB). The setting applies to
buffers created by threads executing online DDL operations.
Defining an appropriate buffer size limit avoids potential out of
memory errors for online DDL operations that create or rebuild
secondary indexes. The maximum buffer size per DDL thread is the
maximum buffer size divided by the number of DDL threads
(innodb_ddl_buffer_size/innodb_ddl_threads).