You can change the operations of the data definition language (DDL) execution engine by setting related parameters. This topic describes how to set parameters related to the DDL execution engine.

Parameters

You can set the following parameters in the DRDS console as needed.

Parameter Scope of impact Default value
ENABLE_ASYNC_DDL Databases and statements TRUE (enabled)
PURE_ASYNC_DDL_MODE Databases, sessions, and statements FALSE (disabled)
MAX_TABLE_PARTITIONS_PER_DB Databases and statements 128

ENABLE_ASYNC_DDL

  • Description
    • This parameter is set to TRUE by default, indicating that the new DDL execution engine is used.
    • If you set this parameter to FALSE, DRDS uses the DDL execution engine of a version earlier than v5.3.12, and the PURE_ASYNC_DDL_MODE and MAX_TABLE_PARTITIONS_PER_DB parameters do not take effect. We recommend that you submit a ticket to determine whether to set this parameter to FALSE. For more information, see Submit a ticket.
  • Usage
    • Database level: Set this parameter on the Parameter Settings page in the DRDS console. The value that you set takes effect for the entire database. For more information, see Set parameters.
    • Statement level: Add a hint, such as /*+TDDL:cmd_extra(ENABLE_ASYNC_DDL=FALSE)*/, at the beginning of a DDL statement, so that this parameter can take effect only for this statement.

PURE_ASYNC_DDL_MODE

  • Description
    • This parameter takes effect only when ENABLE_ASYNC_DDL is set to TRUE.
    • When you set this parameter to FALSE, the client connects to DRDS to execute a DDL statement in synchronous blocking mode. In this way, the client returns a response after it completes the DDL job. After the client is disconnected from DRDS, the ongoing DDL job may be interrupted.
    • When you set this parameter to TRUE, the client connects to DRDS to execute a DDL statement in asynchronous mode. In this way, the client returns a response when a DDL request is received, and the DDL job continues to be run in the background. You can run the SHOW DDL statement to view the status of the DDL job. For more information about how to use this statement, see Job management statements.
    • We recommend that you set this parameter to TRUE when enabling asynchronous mode is explicitly required to prevent unexpected disconnection between the client and DRDS. Otherwise, we recommend that you set this parameter to its default value (FALSE) to ensure that the DDL operations in PolarDB-X DRDS are compatible with those in the ApsaraDB RDS for MySQL instance.
  • Usage
    • Database level: Set this parameter on the Parameter Settings page in the DRDS console. The value that you set takes effect for the entire database. For more information, see Set parameters.
    • Session level:
      • After the client connects to DRDS, execute the set PURE_ASYNC_DDL_MODE=true or set PURE_ASYNC_DDL_MODE=1 statement to enable the asynchronous mode for this session.
      • Execute the set PURE_ASYNC_DDL_MODE=false or set PURE_ASYNC_DDL_MODE=0 statement to restore the default synchronous mode for this session.
    • Statement level: Add a hint, such as /*+TDDL:cmd_extra(PURE_ASYNC_DDL_MODE=TRUE)*/, at the beginning of a DDL statement, so that this parameter can take effect only for this statement.

MAX_TABLE_PARTITIONS_PER_DB

  • Description
    • This parameter takes effect only when ENABLE_ASYNC_DDL is set to TRUE.
    • If the number of table shards in a single physical database exceeds the limit specified by this parameter, the DDL job stops and an error is reported.
      Note The value range of this parameter is 1 to 65535. The default value is 128.
  • Usage
    • Database level: Set this parameter on the Parameter Settings page in the DRDS console. The value that you set takes effect for the entire database. For more information, see Set parameters.
    • Statement level: Add a hint, such as /*+TDDL:cmd_extra(MAX_TABLE_PARTITIONS_PER_DB=400)*/, at the beginning of a DDL statement, so that this parameter can take effect only for this statement.