Skip to content

Commit

Permalink
*: add config variable enable-slow-log (pingcap#2259)
Browse files Browse the repository at this point in the history
  • Loading branch information
SunRunAway authored Feb 24, 2020
1 parent acd7429 commit e5176c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ aliases: ['/docs-cn/sql/slow-query/','/docs-cn/dev/how-to/maintain/identify-slow

TiDB 会将执行时间超过 [slow-threshold](/reference/configuration/tidb-server/configuration-file.md#slow-threshold)(默认值为 300 毫秒)的语句输出到 [slow-query-file](/reference/configuration/tidb-server/configuration-file.md#slow-query-file)(默认值:"tidb-slow.log")日志文件中,用于帮助用户定位慢查询语句,分析和解决 SQL 执行的性能问题。

TiDB 默认启用慢查询日志,可以修改配置 [`enable-slow-log`](/reference/configuration/tidb-server/configuration-file.md#enable-slow-log) 来启用或禁用它。

## 日志示例

```sql
Expand Down
6 changes: 6 additions & 0 deletions reference/configuration/tidb-server/configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ TiDB 配置文件比命令行参数支持更多的选项。你可以在 [config/
>
> 考虑后向兼容性,原来的配置项 `disable-timestamp` 仍然有效,但如果和 `enable-timestamp` 配置的值在语义上冲突(例如在配置中把 `enable-timestamp``disable-timestamp` 同时设置为 `true`),则 TiDB 会忽略 `disable-timestamp` 的值。在未来的版本中,`disable-timestamp` 配置项将被彻底移除,请废弃 `disable-timestamp` 的用法,使用语义上更易于理解的 `enable-timestamp`
### `enable-slow-log`

+ 是否开启慢查询日志
+ 默认值:true
+ 可以设置成 `true``false` 来启用或或禁用慢查询日志。

### `slow-query-file`

+ 慢查询日志的文件名。
Expand Down

0 comments on commit e5176c4

Please sign in to comment.