tencent cloud

Feedback

Binlog Write Optimization

Last updated: 2024-11-14 10:41:29

    Overview

    In row mode, large transactions with multiple rows updated for a single statement will generate one event for each row, creating a large amount of binlogs and leading to decreased database performance. Through analysis on large transaction scenarios, the Tencent Cloud kernel team has developed the binlog write optimization feature to automatically identify large transactions and convert row-based binlogs to statement-based binlogs. It also supports using regular expressions to set the affected databases and tables, thereby reducing the quantity of binlogs and improving the database performance.

    Supported Versions

    Kernel version 3.1.12 or later for TDSQL-C for MySQL.

    Use Cases

    This feature is mainly used to accelerate replay for large transactions where there are not primary keys in tables in row mode. It can be enabled when you are sure that the delay is caused by slow replay due to no primary keys.

    Use Instructions

    The binlog write optimization feature judges whether a transaction is large based on the historical execution statistics of the SQL statement. If a transaction is identified as large and optimizable, its isolation level will be automatically upgraded to Repeatable Read (RR) and the binlogs will be stored in statement format.
    txsql_optimize_large_trans_binlog_mode specifies whether to enable this feature.
    When txsql_optimize_large_trans_binlog_mode is set to PART, this feature is enabled only for tables matching the regular expression set by txsql_optimize_large_trans_binlog_tables. For example:
    set global txsql_optimize_large_trans_binlog_tables = "test.t3,test.t4";
    set global txsql_optimize_large_trans_binlog_tables = "test.t*";
    set global txsql_optimize_large_trans_binlog_tables = "somedb*.t1";
    

    Parameter Description

    Name
    Global or Not
    Type
    Default Value
    Value Range
    Description
    txsql_optimize_large_trans_binlog_mode
    Global
    enum
    OFF
    OFF/ALL/PART
    Whether to enable binlog write optimization. ALL indicates large transaction binlog optimization for all tables. PART indicates enabling the feature for tables matching a specified regular expression. OFF indicates disabling the feature.
    txsql_optimize_large_trans_binlog_tables
    Global
    char
    .
    -
    . indicates dbname.tablename specified in PART mode.
    Both dbname and tablename support regular expressions, such as somedb.t1, indicating that the database somedb and the table t1 both support regular expressions.
    If this parameter is set to test.*, it indicates that all tables under the test database support regular expressions, including tables added to the test database after the parameter is set.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support