Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#18366
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
lilin90 authored and ti-chi-bot committed Aug 20, 2024
1 parent 9abe9a8 commit 3950b54
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 1 deletion.
2 changes: 1 addition & 1 deletion system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,7 @@ Query OK, 0 rows affected, 1 warning (0.00 sec)
- Default value: `300`
- Range: `[-1, 9223372036854775807]`
- Unit: Milliseconds
- This variable is used to output the threshold value of the time consumed by the slow log. When the time consumed by a query is larger than this value, this query is considered as a slow log and its log is output to the slow query log.
- This variable outputs the threshold value of the time consumed by the slow log, and is set to 300 milliseconds by default. When the time consumed by a query is larger than this value, this query is considered as a slow query and its log is output to the slow query log. Note that when the output level of [`log.level`](https://docs.pingcap.com/tidb/dev/tidb-configuration-file#level) is `"debug"`, all queries are recorded in the slow query log, regardless of the setting of this variable.
Usage example:
Expand Down
141 changes: 141 additions & 0 deletions tidb-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,15 @@ Configuration items related to log.
### `slow-threshold`

- Outputs the threshold value of consumed time in the slow log.
<<<<<<< HEAD
- Default value: `300ms`
- If the value in a query is larger than the default value, it is a slow query and is output to the slow log.
=======
- Default value: `300`
- Unit: Milliseconds
- When the time consumed by a query is larger than this value, this query is considered as a slow query and its log is output to the slow query log. Note that when the output level of [`log.level`](#level) is `"debug"`, all queries are recorded in the slow query log, regardless of the setting of this parameter.
- Since v6.1.0, the threshold value of consumed time in the slow log is specified by the TiDB configuration item [`instance.tidb_slow_log_threshold`](/tidb-configuration-file.md#tidb_slow_log_threshold) or the system variable [`tidb_slow_log_threshold`](/system-variables.md#tidb_slow_log_threshold). `slow-threshold` still takes effect. But if `slow-threshold` and `instance.tidb_slow_log_threshold` are set at the same time, the latter takes effect.
>>>>>>> da5669a158 (Refine slow log description (#18366))
### `record-plan-in-slow-log`

Expand Down Expand Up @@ -742,6 +749,140 @@ Configuration items related to read isolation.
- Default value: ["tikv", "tiflash", "tidb"], indicating that the engine is automatically selected by the optimizer.
- Value options: Any combinations of "tikv", "tiflash", and "tidb", for example, ["tikv", "tidb"] or ["tiflash", "tidb"]

<<<<<<< HEAD
=======
## instance

### `tidb_enable_collect_execution_info`

- This configuration controls whether to record the execution information of each operator in the slow query log and whether to record the [usage statistics of indexes](/information-schema/information-schema-tidb-index-usage.md).
- Default value: `true`
- Before v6.1.0, this configuration is set by `enable-collect-execution-info`.

### `tidb_enable_slow_log`

- This configuration is used to control whether to enable the slow log feature.
- Default value: `true`
- Value options: `true` or `false`
- Before v6.1.0, this configuration is set by `enable-slow-log`.

### `tidb_slow_log_threshold`

- Outputs the threshold value of the time consumed by the slow log.
- Default value: `300`
- Range: `[-1, 9223372036854775807]`
- Unit: Milliseconds
- When the time consumed by a query is larger than this value, this query is considered as a slow query and its log is output to the slow query log. Note that when the output level of [`log.level`](#level) is `"debug"`, all queries are recorded in the slow query log, regardless of the setting of this parameter.
- Before v6.1.0, this configuration is set by `slow-threshold`.

### `in-mem-slow-query-topn-num` <span class="version-mark">New in v7.3.0</span>

+ The configuration controls the number of slowest queries that are cached in memory.
+ Default value: 30

### `in-mem-slow-query-recent-num` <span class="version-mark">New in v7.3.0</span>

+ The configuration controls the number of recently used slow queries that are cached in memory.
+ Default value: 500

### `tidb_expensive_query_time_threshold`

- This configuration is used to set the threshold value that determines whether to print expensive query logs. The difference between expensive query logs and slow query logs is:
- Slow logs are printed after the statement is executed.
- Expensive query logs print the statements that are being executed, with execution time exceeding the threshold value, and their related information.
- Default value: `60`
- Range: `[10, 2147483647]`
- Unit: Seconds
- Before v5.4.0, this configuration is set by `expensive-threshold`.

### `tidb_record_plan_in_slow_log`

- This configuration is used to control whether to include the execution plan of slow queries in the slow log.
- Default value: `1`
- Value options: `1` (enabled, default) or `0` (disabled).
- The value of this configuration will initialize the value of system variable [`tidb_record_plan_in_slow_log`](/system-variables.md#tidb_record_plan_in_slow_log)
- Before v6.1.0, this configuration is set by `record-plan-in-slow-log`.

### `tidb_force_priority`

- This configuration is used to change the default priority for statements executed on a TiDB server.
- Default value: `NO_PRIORITY`
- The default value `NO_PRIORITY` means that the priority for statements is not forced to change. Other options are `LOW_PRIORITY`, `DELAYED`, and `HIGH_PRIORITY` in ascending order.
- Before v6.1.0, this configuration is set by `force-priority`.

> **Note:**
>
> Starting from v6.6.0, TiDB supports [Resource Control](/tidb-resource-control.md). You can use this feature to execute SQL statements with different priorities in different resource groups. By configuring proper quotas and priorities for these resource groups, you can gain better scheduling control for SQL statements with different priorities. When resource control is enabled, statement priority will no longer take effect. It is recommended that you use [Resource Control](/tidb-resource-control.md) to manage resource usage for different SQL statements.
### `max_connections`

- The maximum number of connections permitted for a single TiDB instance. It can be used for resources control.
- Default value: `0`
- Range: `[0, 100000]`
- The default value `0` means no limit. When the value of this variable is larger than `0`, and the number of connections reaches the value, the TiDB server will reject new connections from clients.
- The value of this configuration will initialize the value of system variable [`max_connections`](/system-variables.md#max_connections)
- Before v6.2.0, this configuration is set by `max-server-connections`.

### `tidb_enable_ddl`

- This configuration controls whether the corresponding TiDB instance can become a DDL owner or not.
- Default value: `true`
- Possible values: `OFF`, `ON`
- The value of this configuration will initialize the value of the system variable [`tidb_enable_ddl`](/system-variables.md#tidb_enable_ddl-new-in-v630)
- Before v6.3.0, this configuration is set by `run-ddl`.

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

> **Warning:**
>
> Statements summary persistence is an experimental feature. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.
+ Controls whether to enable statements summary persistence.
+ Default value: `false`
+ For more details, see [Persist statements summary](/statement-summary-tables.md#persist-statements-summary).

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

> **Warning:**
>
> Statements summary persistence is an experimental feature. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.
+ When statements summary persistence is enabled, this configuration specifies the file to which persistent data is written.
+ Default value: `tidb-statements.log`

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

> **Warning:**
>
> Statements summary persistence is an experimental feature. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.
+ When statements summary persistence is enabled, this configuration specifies the maximum number of days to keep persistent data files.
+ Default value: `3`
+ Unit: day
+ You can adjust the value based on the data retention requirements and disk space usage.

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

> **Warning:**
>
> Statements summary persistence is an experimental feature. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.
+ When statements summary persistence is enabled, this configuration specifies the maximum size of a persistent data file.
+ Default value: `64`
+ Unit: MiB
+ You can adjust the value based on the data retention requirements and disk space usage.

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

> **Warning:**
>
> Statements summary persistence is an experimental feature. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.
+ When statements summary persistence is enabled, this configuration specifies the maximum number of data files that can be persisted. `0` means no limit on the number of files.
+ Default value: `0`
+ You can adjust the value based on the data retention requirements and disk space usage.

>>>>>>> da5669a158 (Refine slow log description (#18366))
## proxy-protocol

Configuration items related to the PROXY protocol.
Expand Down

0 comments on commit 3950b54

Please sign in to comment.