-
Notifications
You must be signed in to change notification settings - Fork 711
docs: add documentation for ADMIN ALTER DDL JOBS command #19492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
18afd37
docs: add documentation for ADMIN ALTER DDL JOBS command
tangenta b753d92
Update TOC.md
hfxsd f8ba311
Update sql-statement-admin-alter-ddl.md
hfxsd 4de1d6e
Update sql-statements/sql-statement-admin-show-ddl.md
tangenta b9e1679
Update sql-statements/sql-statement-admin-show-ddl.md
tangenta 6823bb0
Update sql-statements/sql-statement-admin-alter-ddl.md
tangenta 09e4e7f
Apply suggestions from code review
hfxsd 722b394
Update sql-statements/sql-statement-admin-alter-ddl.md
hfxsd 47cc83a
Apply suggestions from code review
hfxsd 250d189
Apply suggestions from code review
hfxsd 7521a93
Apply suggestions from code review
hfxsd ff3c547
Apply suggestions from code review
hfxsd 85b6567
Update format
lilin90 228ffdf
Apply suggestions from code review
lilin90 0eda3df
Refine wording and format
lilin90 e540032
Update wording
lilin90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| --- | ||
| title: ADMIN ALTER DDL JOBS | ||
| summary: An overview of the usage of `ADMIN ALTER DDL JOBS` for the TiDB database. | ||
| --- | ||
|
|
||
| # ADMIN ALTER DDL JOBS | ||
|
|
||
| The `ADMIN ALTER DDL JOBS` statement allows you to modify the parameter of a single running DDL job. For example: | ||
|
|
||
| ```sql | ||
| ADMIN ALTER DDL JOBS 101 THREAD = 8; | ||
| ``` | ||
|
|
||
| - `101`: indicates the ID of the DDL job. You can obtain the ID by executing [`ADMIN SHOW DDL JOBS`](/sql-statements/sql-statement-admin-show-ddl.md). | ||
| - `THREAD`: indicates the concurrency of the DDL job. You can configure its initial value using the system variable [`tidb_ddl_reorg_worker_cnt`](/system-variables.md#tidb_ddl_reorg_worker_cnt). | ||
|
|
||
| The DDL job types supported by the `ADMIN ALTER DDL JOBS` statement include `ADD INDEX`, `MODIFY COLUMN`, and `REORGANIZE PARTITION`. For other DDL job types, executing `ADMIN ALTER DDL JOBS` returns the `unsupported DDL operation` error. | ||
|
|
||
| Currently, you can only modify the parameters of a single DDL job by executing `ADMIN ALTER DDL JOBS`. Modifying the parameters of multiple DDL job IDs at the same time is not supported. | ||
|
|
||
| The following are the supported parameters for different DDL jobs and their corresponding system variables: | ||
|
|
||
| - `ADD INDEX`: | ||
| - `THREAD`: the concurrency of the DDL job. The initial value is set by `tidb_ddl_reorg_worker_cnt`. | ||
| - `BATCH_SIZE`: the batch size. The initial value is set by [`tidb_ddl_reorg_batch_size`](/system-variables.md#tidb_ddl_reorg_batch_size). | ||
| - `MAX_WRITE_SPEED`: the maximum bandwidth limit for importing index records into each TiKV. The initial value is set by [`tidb_ddl_reorg_max_write_speed`](/system-variables.md#tidb_ddl_reorg_max_write_speed-new-in-v850). | ||
|
hfxsd marked this conversation as resolved.
|
||
|
|
||
| Currently, the preceding parameters only work for `ADD INDEX` jobs that are submitted and running after [`tidb_enable_dist_task`](/system-variables.md#tidb_enable_dist_task-new-in-v710) is disabled. | ||
|
|
||
| - `MODIFY COLUMN`: | ||
| - `THREAD`: the concurrency of the DDL job. The initial value is set by `tidb_ddl_reorg_worker_cnt`. | ||
| - `BATCH_SIZE`: the batch size. The initial value is set by `tidb_ddl_reorg_batch_size`. | ||
|
|
||
| - `REORGANIZE PARTITION`: | ||
| - `THREAD`: the concurrency of the DDL job. The initial value is set by `tidb_ddl_reorg_worker_cnt`. | ||
| - `BATCH_SIZE`: the batch size. The initial value is set by `tidb_ddl_reorg_batch_size`. | ||
|
|
||
| The value ranges of the preceding parameters are consistent with those of the corresponding system variables. | ||
|
|
||
| `ADMIN ALTER DDL JOBS` takes effect only on running DDL jobs. If the DDL job does not exist or has already completed, executing this statement returns the `ddl job is not running` error. | ||
|
|
||
| The following are some examples of this statement: | ||
|
|
||
| ```sql | ||
| ADMIN ALTER DDL JOBS 101 THREAD = 8; | ||
| ADMIN ALTER DDL JOBS 101 BATCH_SIZE = 256; | ||
| ADMIN ALTER DDL JOBS 101 MAX_WRITE_SPEED = '200MiB'; | ||
| ADMIN ALTER DDL JOBS 101 THREAD = 8, BATCH_SIZE = 256; | ||
| ``` | ||
|
|
||
| To view the current parameter values for a specific DDL job, you can execute `ADMIN SHOW DDL JOBS`. The results are displayed in the `COMMENTS` column: | ||
|
|
||
| ```sql | ||
| ADMIN SHOW DDL JOBS 1; | ||
| ``` | ||
|
|
||
| ``` | ||
| +--------+---------+------------+-----------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+--------+-----------------------+ | ||
| | JOB_ID | DB_NAME | TABLE_NAME | JOB_TYPE | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME | START_TIME | END_TIME | STATE | COMMENTS | | ||
| +--------+---------+------------+-----------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+--------+-----------------------+ | ||
| | 124 | test | t | add index | public | 2 | 122 | 3 | 2024-11-15 11:17:06.213000 | 2024-11-15 11:17:06.213000 | 2024-11-15 11:17:08.363000 | synced | ingest, DXF, thread=8 | | ||
| +--------+---------+------------+-----------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+--------+-----------------------+ | ||
| 1 row in set (0.01 sec) | ||
| ``` | ||
|
|
||
| ## Synopsis | ||
|
|
||
| ```ebnf+diagram | ||
| AdminAlterDDLStmt ::= | ||
| 'ADMIN' 'ALTER' 'DDL' 'JOBS' Int64Num AlterJobOptionList | ||
|
|
||
| AlterJobOptionList ::= | ||
| AlterJobOption ( ',' AlterJobOption )* | ||
|
|
||
| AlterJobOption ::= | ||
| identifier "=" SignedLiteral | ||
| ``` | ||
|
|
||
| ## MySQL compatibility | ||
|
|
||
| This statement is a TiDB extension to MySQL syntax. | ||
|
|
||
| ## See also | ||
|
|
||
| * [`ADMIN SHOW DDL [JOBS|QUERIES]`](/sql-statements/sql-statement-admin-show-ddl.md) | ||
| * [`ADMIN CANCEL DDL`](/sql-statements/sql-statement-admin-cancel-ddl.md) | ||
| * [`ADMIN PAUSE DDL`](/sql-statements/sql-statement-admin-pause-ddl.md) | ||
| * [`ADMIN RESUME DDL`](/sql-statements/sql-statement-admin-resume-ddl.md) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.