By default, mysqlbinlog combines all row events corresponding to a single statement into one BINLOG statement when reading a binary log. Therefore, the resulting BINLOG statements could be arbitrarily long for INSERT/DELETE/UPDATE statements affecting many rows on the master, even when the individual row events are small. This could lead to problems with roll-forwarding when the server's max_allowed_packet was not large enough to accomodate the largest BINLOG statement.

For example, removing 1 GB of data with a single DELETE statement from a table with a maximum row size of 1 MB would likely result in multiple DELETE_ROWS_EVENT events, depending on the value of the binlog-row-event-max-size server system variable. However, when reading those events from the binary log, mysqlbinlog would combine them into a 1 GB (+ base64 overhead) BINLOG statement which would lead to the ER_NET_PACKET_TOO_LARGE error when piped into the server.

This feature fixes that problem by introducing a new mysqlbinlog command line option, –binlog-stmt-max-size. The option sets an upper limit on the size of the generated BINLOG statements when possible, i.e. when the size of individual row events does not exceed this limit. The default value for the option is 1 MB.

Version Specific Information

Percona Server Version Comments
release-5.1.52-12-rnt Full functionality available.

Other Information

Author/Origin Alexey Kopytov

Command line options

General Description:
Utility mysqlbinlog
Command Line Yes
Config File Yes
Permitted Values:
Type Numeric
Default Value 1048576
Range 0 - 4294967295
Units bytes

Implementation Details

percona-server/features/special/mysqlbinlog_max_binlog_statement_size.txt · Last modified: 2015/08/05 15:37 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Contact Us 24 Hours A Day
SupportContact us 24×7
Emergency? Contact us for help now!
Sales North America(888) 316-9775 or
(208) 473-2904
+44-208-133-0309 (UK)
0-800-051-8984 (UK)
0-800-181-0665 (GER)
Training(855) 55TRAIN or
(925) 271-5054


Share This
]]> ]]>