bulk_insert_buffer_size

Tuning bulk_insert_buffer_size variable

Basic Details

The bulk_insert_buffer_size variable sets the size of the buffer for bulk inserts cache-tree.

Releem automatically tunes bulk_insert_buffer_size and 44 other variables to improve MySQL performance. Try Releem for Free, or deepen your understanding by reading our detailed article.

bulk_insert_buffer_size – Usage

A bulk insert is a method of loading multiple rows of data into a database table. The following statements are bulk actions that speed up when MyISAM uses the special tree-like cache known as the bulk_insert_buffer_size: INSERT ... VALUES
Setting the bulk_insert_buffer_size variable limits the size of the cache tree in bytes per thread.

bulk_insert_buffer_size– Configuration

According to MySQL documentation, setting the session value of the bulk_insert_buffer_size variable has been restricted since MySQL 8.0.14, The session user must have the appropriate privileges to set the restricted bulk_insert_buffer_size variable.

The bulk_insert_buffer_size variable system variable can be configured using the configuration file:
Configuration File:
[mysqld]
bulk_insert_buffer_size variable = XX

Replace XX with value to suit your database needs. Must restart MySQL server to see changes applied.

bulk_insert_buffer_size – Considerations

The bulk_insert_buffer_size variable can improve data insertion rates if data is added to non-empty tables. This variable only affects MyISAM tables and will not change InnoDB tables. The default value for the bulk_insert_buffer_size variable is 8 MB. The improvement is more obvious when inserting data in more than 10,000 rows.

To find the best value for bulk_insert_buffer_size, incrementally increase buffer size values until a performance improvement is apparent.

If you don’t want to fuss with incremental changes, to get bulk_insert_buffer_size just right, Releem can determine the perfect value for your server.
Releem Agent automatically collects MySQL metrics, system information and transfers them to the Releem Cloud Platform. Releem Cloud Platform will calculate Releem Score and improve your server performance with its recommended configuration. Releem can automatically apply these settings, including any recommendations for bulk_insert_buffer_size variable. Releem is simple, hassle-free, and effective way to tune and manage MySQL, Percona, and MariaDB servers.
Releem automatically detects MySQL performance degradation and optimizes MySQL configuration files