Skip to main content

Menu

Webinar

Built for the Agentic Era: Introducing MariaDB Enterprise Platform 2027

Register now

Tech Talk

Binlog Commit Optimization For Large Transaction

By MariaDB

9 min read
Share
MariaDB [(none)]> select query_time, sql_text from mysql.slow_log;
+-----------------+---------------------------------+
| query_time | sql_text |
+-----------------+---------------------------------+
| 00:00:04.010262 | INSERT INTO t1 SELECT * FROM t2 |
| 00:00:02.004051 | COMMIT |
| 00:00:03.008076 | INSERT INTO t1 VALUES(2) |
+-----------------+---------------------------------+
MariaDB [(none)]> select ID, TIME, STATE, INFO from information_schema.processlist;
+----+------+--------+--------------------------+
| ID | TIME | STATE | INFO |
+----+------+--------+--------------------------+
| 7 | 2 | Commit | COMMIT |
| 6 | 3 | Commit | INSERT INTO t1 VALUES(2) |
+----+------+--------+--------------------------+
$ls var/mysqld.1/data/#binlog_cache_files                              
ML_140413554102520
CREATE TABLE t_large (a INT, b LONGTEXT) ENGINE = InnoDB;


# UPDATE includes before and after image, updating
# a row with 256MB text will generate a 512MB binlog event.
INSERT INTO t_large(1, repeat('a', 256000000));


UPDATE t_large SET a = a + 1;