diff --git a/time-to-live.md b/time-to-live.md index 6cebaa11b770e..eaf29b177b753 100644 --- a/time-to-live.md +++ b/time-to-live.md @@ -128,15 +128,17 @@ CREATE TABLE orders ( ## TTL job -For each table with a TTL attribute, TiDB internally schedules a background job to clean up expired data. You can customize the execution period of these jobs by setting the `TTL_JOB_INTERVAL` attribute for the table. The following example sets the background cleanup jobs for the table `orders` to run once every 24 hours: +For each table with a TTL attribute, TiDB internally schedules a background job to clean up expired data. You can customize the execution period of these jobs by setting the `TTL_JOB_INTERVAL` attribute for the table. The following example sets the background cleanup jobs for the table `orders` to run once every 48 hours: ```sql -ALTER TABLE orders TTL_JOB_INTERVAL = '24h'; +ALTER TABLE orders TTL_JOB_INTERVAL = '48h'; ``` -`TTL_JOB_INTERVAL` is set to `1h` by default. +`TTL_JOB_INTERVAL` is set to `24h` by default (`1h` in v8.5 and the earlier version). -When executing a TTL job, TiDB will split the table into up to 64 tasks, with the Region being the smallest unit. These tasks will be executed distributedly. You can limit the number of concurrent TTL tasks across the entire cluster by setting the system variable [`tidb_ttl_running_tasks`](/system-variables.md#tidb_ttl_running_tasks-new-in-v700). However, not all TTL jobs for all kinds of tables can be split into tasks. For more details on which kinds of tables' TTL jobs cannot be split into tasks, refer to the [Limitations](#limitations) section. +When executing a TTL job, TiDB will split the table into some tasks, with the Region being the smallest unit. These tasks will be executed distributedly. Typically, the maximum number of tasks for a single table is 64. But for larger clusters, such as those with more than 64 TiKV instances, the maximum number of tasks that a single table can be split into is equal to the number of TiKV instances. However, not all TTL jobs for all kinds of tables can be split into tasks. For more details on which kinds of tables' TTL jobs cannot be split into tasks, refer to the [Limitations](#limitations) section. + +TiDB also limits the number of concurrent TTL tasks at the cluster level. You can set the system variable [`tidb_ttl_running_tasks`](/system-variables.md#tidb_ttl_running_tasks-new-in-v700) to change this concurrency. To disable the execution of TTL jobs, in addition to setting the `TTL_ENABLE='OFF'` table option, you can also disable the execution of TTL jobs in the entire cluster by setting the [`tidb_ttl_job_enable`](/system-variables.md#tidb_ttl_job_enable-new-in-v650) global variable: