OceanBase Database supports parallel DDL operations to improve the execution efficiency of DDL statements.
Configure parallel DDL
In OceanBase Database, you can flexibly control the parallel DDL feature by configuring parameters:
_enable_parallel_table_creation: controls parallelCREATE TABLEoperations._parallel_ddl_control: controls the following parallel operations:TRUNCATE TABLEDROP TABLECREATE INDEXCREATE VIEWCOMMENTADD_COLUMNDROP_COLUMNADD_PARTITIONADD_SUB_PARTITIONDROP_PARTITIONDROP_SUB_PARTITIONTRUNCATE_PARTITIONTRUNCATE_SUB_PARTITION
_enable_parallel_table_creation
_enable_parallel_table_creation specifies whether to enable concurrent table creation (CREATE TABLE) at the tenant level.
Attribute |
Description |
|---|---|
| Parameter type | Boolean |
| Default Value | True, indicating that concurrent table creation is enabled. |
| Value range |
|
| Effective Mode | Effective Immediately |
Examples
Execute the following statement in the
systenant to disable concurrent table creation for the user tenantmysql001.ALTER SYSTEM SET _enable_parallel_table_creation = false tenant=mysql001;Execute the following statement in the user tenant to disable concurrent table creation.
MySQL-compatible mode:
ALTER SYSTEM SET _enable_parallel_table_creation = false;Oracle-compatible mode:
Note In Oracle-compatible mode, parameters are enclosed in double quotes by default.
ALTER SYSTEM SET "_enable_parallel_table_creation" = false;
_parallel_ddl_control
_parallel_ddl_control specifies whether to enable parallel DDL operations at the tenant level. This parameter takes effect only when the corresponding DDL operation is performed on the tenant.
Attribute |
Description |
|
|---|---|---|
| Parameter type | STRING | |
| Default Value | Empty string. The semantics are as follows:
NoteFor individual parallel DDL operations, the default value for DDL types other than |
|
| Value range | An empty string, or DDL:{ON \ |
OFF} [, DDL:{ON \ | OFF}] [, ...]. For details about DDL type information, see the table below. |
| Effective Mode | Effective Immediately |
DDL type information:
DDL type |
Valid values |
|
|---|---|---|
| TRUNCATE_TABLE | TRUNCATE_TABLE:{ON \ | OFF} |
| SET_COMMENT | SET_COMMENT:{ON \ | OFF} |
| CREATE_INDEX | CREATE_INDEX:{ON \ | OFF} |
| CREATE_VIEW | CREATE_VIEW:{ON \ | OFF} |
| DROP_TABLE | DROP_TABLE:{ON \ | OFF} |
| ADD_COLUMN | ADD_COLUMN:{ON \ | OFF} |
| DROP_COLUMN | DROP_COLUMN:{ON \ | OFF} |
| ADD_PARTITION | ADD_PARTITION:{ON \ | OFF} |
| ADD_SUB_PARTITION | ADD_SUB_PARTITION:{ON \ | OFF} |
| DROP_PARTITION | DROP_PARTITION:{ON \ | OFF} |
| DROP_SUB_PARTITION | DROP_SUB_PARTITION:{ON \ | OFF} |
| TRUNCATE_PARTITION | TRUNCATE_PARTITION:{ON \ | OFF} |
| TRUNCATE_SUB_PARTITION | TRUNCATE_SUB_PARTITION:{ON \ | OFF} |
Notice
- The current version of OceanBase Database does not support concurrent execution of full-text indexes, multi-valued indexes, or vector indexes.
- For V5.x versions, the
_parallel_ddl_controlparameter was introduced in V5.0.1 and supports the following DDL operations:ADD_COLUMN,DROP_COLUMN,ADD_PARTITION,ADD_SUB_PARTITION,DROP_PARTITION,DROP_SUB_PARTITION,TRUNCATE_PARTITION, andTRUNCATE_SUB_PARTITION.
Examples
Execute the following statement in the
systenant to disable parallelTRUNCATE TABLEand enable parallelCREATE INDEXfor the user tenantmysql001.ALTER SYSTEM SET _parallel_ddl_control = 'CREATE_INDEX:ON, TRUNCATE_TABLE:OFF' tenant = 'mysql001';Execute the following statement in the user tenant to disable parallel
TRUNCATE TABLEand enable parallelCREATE INDEX.MySQL-compatible mode:
ALTER SYSTEM SET _parallel_ddl_control = 'CREATE_INDEX:ON, TRUNCATE_TABLE:OFF';Oracle-compatible mode:
Note In Oracle-compatible mode, double quotes are required around configuration parameters that are specified implicitly in the syntax.
ALTER SYSTEM SET "_parallel_ddl_control" = 'CREATE_INDEX:ON, TRUNCATE_TABLE:OFF';
Default DDL parallelism
In OceanBase Database, you can use the session-level parameter _force_parallel_ddl_dop to specify the default parallelism for DDL operations executed in parallel.
If the parallelism is not explicitly specified using the PARALLEL hint, DDL will use the value set by _force_parallel_ddl_dop.
When using the parallel DDL feature, you can pre-set the parallelism for DDL operations executed in parallel via _force_parallel_ddl_dop.
Example
Execute the following statement in the user tenant to set the default parallelism for DDL operations executed in parallel at the session level to 16.
MySQL-compatible mode:
SET _FORCE_PARALLEL_DDL_DOP = 16;
Oracle-compatible mode:
SET "_FORCE_PARALLEL_DDL_DOP" = 16;
