You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
summary: An overview of the usage of CANCEL DISTRIBUTION JOB in TiDB.
4
+
---
5
+
6
+
# CANCEL DISTRIBUTION JOB
7
+
8
+
The `CANCEL DISTRIBUTION JOB` statement is used to cancel a Region scheduling task created using the [`DISTRIBUTE TABLE`](/sql-statements/sql-statement-distribute-table.md) statement in TiDB.
9
+
10
+
## Syntax diagram
11
+
12
+
```ebnf+diagram
13
+
CancelDistributionJobsStmt ::=
14
+
'CANCEL' 'DISTRIBUTION' 'JOB' JobID
15
+
```
16
+
17
+
## Examples
18
+
19
+
The following example cancels the distribution job with ID `1`:
20
+
21
+
```sql
22
+
CANCEL DISTRIBUTION JOB 1;
23
+
```
24
+
25
+
The output is as follows:
26
+
27
+
```
28
+
Query OK, 0 rows affected (0.01 sec)
29
+
```
30
+
31
+
## MySQL compatibility
32
+
33
+
This statement is a TiDB extension to MySQL syntax.
When redistributing Regions in a table using the `DISTRIBUTE TABLE` statement, you can specify the storage engine (such as TiFlash or TiKV) and different Raft roles (such as Leader, Learner, or Voter) for balanced distribution.
28
26
29
-
## Examples
27
+
-`RULE`: specifies which Raft role's Region to balance and schedule. Optional values are `"leader-scatter"`, `"peer-scatter"`, and `"learner-scatter"`.
28
+
-`ENGINE`: specifies the storage engine. Optional values are `"tikv"` and `"tiflash"`.
29
+
-`TIMEOUT`: specifies the timeout limit for the scatter operation. If PD does not complete the scatter within this time, the scatter task will automatically exit. When this parameter is not specified, the default value is `"30m"`.
30
30
31
-
When redistributing Regions using the `DISTRIBUTE TABLE` statement, you can specify the storage engine (such as TiFlash or TiKV) and different Raft roles (such as Leader, Learner, or Voter) for balanced distribution.
31
+
## Examples
32
32
33
33
Redistribute the Regions of the Leaders in the table `t1` on TiKV:
Execute the [`SHOW TABLE DISTRIBUTION`](/sql-statements/sql-statement-show-table-distribution.md) statement to view the Region distribution of the table `t1`:
84
+
Redistribute the Regions of the Leaders in the table `t4`'s `p1` and `p2` partitions on TiFlash:
96
85
97
86
```sql
98
-
SHOW TABLE DISTRIBUTION t1;
87
+
CREATETABLEt4 ( a INT, b INT, INDEX idx(b)) PARTITION BY RANGE( a ) (
0 commit comments