tencent cloud

Feedback

Parallel Copy DDL

Last updated: 2024-12-11 10:23:54

    Overview

    During database Ops, Data Definition Language (DDL) operations often become sensitive operations that impact database performance due to their modifications to data structures, especially when executed on a large number of tables. Traditional Copy DDL operations may cause prolonged lock waits, affecting normal business operations. To address this issue, TXSQL introduces the Parallel Copy DDL mechanism. Compared to traditional Copy DDL, Parallel Copy DDL uses the InnoDB layer's Parallel Reader framework to read data from the original table in parallel and insert it into a created temporary table, thereby improving data migration efficiency.

    Supported Versions

    Kernel version: TXSQL 5.7 2.1.13.001 and later.
    Kernel version: TXSQL 8.0 3.1.15.001 and later.

    Applicable Scenario

    Copy DDL resides in the upper layer of the storage engine, that is, the execution layer. It calls engine layer interfaces only for querying and inserting, without directly operating on files. Any DDL operation can be abstracted to this execution method, so all DDL operations can be executed using the Copy algorithm.
    Parallel Copy DDL is applicable to the following scenarios:
    Table structure modifications with large data volumes, such as adding new columns or modifying column types.
    Scenarios requiring quick completion of DDL operations to minimize business impact.
    Scenarios with strict requirements on database performance, needing to reduce lock wait time caused by DDL operations.

    Notes

    The following types of tables do not currently support Parallel Copy DDL:
    Non-InnoDB tables.
    Temporary tables.
    Tables using alter table order by, which have requirements on row orders and need to be processed with a single thread.
    Tables with newly added auto-increment columns.
    Partitioned tables.
    Tables with foreign key constraints.
    Tables with multi-value function indexes.

    Use Instructions

    Add two session-level parameters.
    Parameter Name
    Level
    Type
    Default Value
    Value
    Description
    txsql_parallel_copy_ddl
    session
    bool
    0
    0/1
    Whether to enable the Parallel Copy DDL feature.
    1 means enabling the Parallel Copy DDL feature.
    0 means disabling the Parallel Copy DDL feature.
    innodb_parallel_read_threads
    session
    int
    4
    1 - 256
    Number of threads used by Parallel Read.
    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