Skip to content

Commit

Permalink
FAQ: add processing time of DDL
Browse files Browse the repository at this point in the history
  • Loading branch information
lilin90 committed Jun 14, 2018
1 parent 40ebc4f commit e28d094
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,23 @@ The offline node usually indicates the TiKV node. You can determine whether the
The lease parameter (`--lease=60`) is set from the command line when starting a TiDB server. The value of the lease parameter impacts the Database Schema Changes (DDL) speed of the current session. In the testing environments, you can set the value to 1s for to speed up the testing cycle. But in the production environments, it is recommended to set the value to minutes (for example, 60) to ensure the DDL safety.
#### What is the processing time of a DDL operation?
Generally, the processing time of a DDL statement can be divided into three conditions:
1. The `Add Index` operation with a relatively small number of rows in the corresponding data table: about 3s
2. The `Add Index` operation with a relatively large number of rows in the corresponding data table: the processing time depends on the specific number of rows and the QPS at that time (the `Add Index` operation has a lower priority than ordinary SQL operations)
3. Other DDL operations: about 1s
Besides, if the TiDB server that receives the DDL request is same TiDB server that the DDL owner is in, the first and third conditions above might cost dozens to hundreds of milliseconds.
#### Why it is very slow to run DDL statements sometimes?
Possible reasons:
- If you run multiple DDL statements together, the last few DDL statements might run slowly. This is because the DDL statements are executed serially in the TiDB cluster.
- After you start the cluster successfully, the first DDL operation may take a longer time to run, usually around 30s. This is because the TiDB cluster is electing the leader that processes DDL statements.
- In rolling updates or shutdown updates, the processing time of DDL statements in the first ten minutes after starting TiDB is affected by the server stop sequence (stopping PD -> TiDB), and the condition where TiDB does not clean up the registration data in time because TiDB is stopped using the `kill -9` command. When you run DDL statements during this period, for the state change of each DDL, you need to wait for 2 * lease (lease = 10s).
- The processing time of DDL statements in the first ten minutes after starting TiDB is affected by two conditions: 1) TiDB cannot communicate with PD as usual when you are stopping TiDB (including the case of power failure); 2) TiDB fails to clean up the registration data from PD in time because TiDB is stopped by the `kill -9` command. If you run DDL statements during this period, for the state change of each DDL, you need to wait for 2 * lease (lease = 45s).
- If a communication issue occurs between a TiDB server and a PD server in the cluster, the TiDB server cannot get or update the version information from the PD server in time. In this case, you need to wait for 2 * lease for the state processing of each DDL.
#### Can I use S3 as the backend storage engine in TiDB?
Expand Down

0 comments on commit e28d094

Please sign in to comment.