diff --git a/keywords.md b/keywords.md index dc2818ff6254d..a437c4f93be2e 100644 --- a/keywords.md +++ b/keywords.md @@ -671,6 +671,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - THAN - THEN (R) - TIDB (R) +- TiDB_CURRENT_TSO (R) - TIFLASH (R) - TIKV_IMPORTER - TIME @@ -694,7 +695,6 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with - TTL_ENABLE - TTL_JOB_INTERVAL - TYPE -- TiDB_CURRENT_TSO (R) U diff --git a/statistics.md b/statistics.md index 22ba03ac459eb..0b50fc916f9ea 100644 --- a/statistics.md +++ b/statistics.md @@ -358,7 +358,19 @@ You can perform incremental collection using the following syntax. ### Automatic update -For the `INSERT`, `DELETE`, or `UPDATE` statements, TiDB automatically updates the number of rows and updated rows. TiDB persists this information regularly and the update cycle is 20 * `stats-lease`. The default value of `stats-lease` is `3s`. If you specify the value as `0`, it does not update automatically. + + +For the `INSERT`, `DELETE`, or `UPDATE` statements, TiDB automatically updates the number of rows and modified rows. TiDB persists this information regularly and the update cycle is 20 * [`stats-lease`](/tidb-configuration-file.md#stats-lease). The default value of `stats-lease` is `3s`. If you specify the value as `0`, TiDB stops updating statistics automatically. + + + + + +For the `INSERT`, `DELETE`, or `UPDATE` statements, TiDB automatically updates the number of rows and modified rows. TiDB persists this information regularly and the update cycle is 20 * `stats-lease`. The default value of `stats-lease` is `3s`. + + + +### Relevant system variables Three system variables related to automatic update of statistics are as follows: @@ -376,6 +388,12 @@ To avoid the situation that modifying a small amount of data on a small table fr > > Currently, the automatic update does not record the configuration items input at manual `ANALYZE`. Therefore, when you use the `WITH` syntax to control the collecting behavior of `ANALYZE`, you need to manually set scheduled tasks to collect statistics. +#### Disable automatic update + +If you find that automatic update of statistics consumes excessive resources and affects online application operations, you can disable it using the [`tidb_enable_auto_analyze`](/system-variables.md#tidb_enable_auto_analyze-new-in-v610) system variable. + +#### Terminate background `ANALYZE` tasks + Since TiDB v6.0, TiDB supports using the `KILL` statement to terminate an `ANALYZE` task running in the background. If you find that an `ANALYZE` task running in the background consumes a lot of resources and affects your application, you can terminate the `ANALYZE` task by taking the following steps: 1. Execute the following SQL statement: