Skip to content

Commit

Permalink
add system variable tidb_max_auto_analyze_time (#8790) (#8873)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot committed Jun 10, 2022
1 parent ca57bb8 commit 8ebb5b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ Starting from TiDB v6.1.0, the `SHOW ANALYZE STATUS` statement supports showing

`SHOW ANALYZE STATUS` shows the most recent task records only. Starting from TiDB v6.1.0, you can view the history tasks within the last 7 days through the system table `mysql.analyze_jobs`.

When [`tidb_mem_quota_analyze`](/system-variables.md#tidb_mem_quota_analyze-new-in-v610) is set and the automatic analysis task in the TiDB background uses more memory than this threshold, the task will be retried. You can see failed and retried tasks in the output of the `SHOW ANALYZE STATUS` statement.
When [`tidb_mem_quota_analyze`](/system-variables.md#tidb_mem_quota_analyze-new-in-v610) is set and an automatic `ANALYZE` task running in the TiDB background uses more memory than this threshold, the task will be retried. You can see failed and retried tasks in the output of the `SHOW ANALYZE STATUS` statement.

When [`tidb_max_auto_analyze_time`](/system-variables.md#tidb_max_auto_analyze_time-new-in-v610) is greater than 0 and an automatic `ANALYZE` task running in the TiDB background takes more time than this threshold, the task will be terminated.

```sql
mysql> SHOW ANALYZE STATUS [ShowLikeOrWhere];
Expand Down
9 changes: 9 additions & 0 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,15 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a
- Default value: `00:00 +0000`
- This variable is used to restrict the time window that the automatic update of statistics is permitted. For example, to only allow automatic statistics updates between 1 AM and 3 AM, set `tidb_auto_analyze_start_time='01:00 +0000'` and `tidb_auto_analyze_end_time='03:00 +0000'`.

### `tidb_max_auto_analyze_time` <span class="version-mark">New in v6.1.0</span>

- Scope: GLOBAL
- Persists to cluster: Yes
- Default value: `43200`
- Range: `[0, 2147483647]`
- Unit: seconds
- This variable is used to specify the maximum execution time of automatic `ANALYZE` tasks. When the execution time of an automatic `ANALYZE` task exceeds the specified time, the task will be terminated. When the value of this variable is `0`, there is no limit to the maximum execution time of automatic `ANALYZE` tasks.

### tidb_backoff_lock_fast

- Scope: SESSION | GLOBAL
Expand Down

0 comments on commit 8ebb5b2

Please sign in to comment.