Slow Log Parameters

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 慢日志参数

| username: chenhanneu

【TiDB Usage Environment】Production Environment / Testing / PoC
【TiDB Version】
【Reproduction Path】What operations were performed when the issue occurred
【Encountered Issue: Issue Phenomenon and Impact】
【Resource Configuration】Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
【Attachments: Screenshots/Logs/Monitoring】
1703655395771


These two slow log parameters, one in TiDB and one in TiKV, what is the difference?

| username: WalterWj | Original post link

TiDB has a feature similar to MySQL for recording slow SQL queries. On the TiKV side, it should be the scan tasks on the TiKV side, recording tasks that exceed 1 second. There is a correlation, but the records are different.

| username: tidb菜鸟一只 | Original post link

If you want to log slow SQL, use TiDB’s file parameters or system variables. The one in TiKV logs situations where the storage node retrieves records slowly…

| username: Inkjade | Original post link

These two parameters focus on different dimensions. The TiDB server focuses on the overall slow SQL execution, similar to MySQL’s slow SQL feature, while TiKV only focuses on slow storage situations. My understanding is that the TiDB server’s slow SQL includes TiKV’s, forming an inclusive relationship.

slow-log-file

  • The file for storing slow logs.
  • If this item is not set but log.file.filename is set, slow logs will be output to the log file specified by log.file.filename.
  • If neither this item nor log.file.filename is set, all logs will default to output to "stderr".
  • If both items are set, regular logs will be output to the log file specified by log.file.filename, while slow logs will be output to the log file specified by this configuration item.
  • Default value: “”
| username: heiwandou | Original post link

The definition of slow log duration for the two types of nodes, TiKV and TiDB.

| username: andone | Original post link

TiDB is the entire cluster, TiKV refers to only the TiKV nodes.

| username: dba远航 | Original post link

TiDB should be global, while TiKV is individual.

| username: Kongdom | Original post link

You can make a suggestion; the documentation is indeed not clearly described.