Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb集群无当天慢查询日志记录-tidb_slow_query.log
There are no slow query log records for today in the TiDB cluster’s tidb_slow_query.log, only records from yesterday and before. Could it be due to a configuration issue or some other reason?
What version of TiDB is it?
tiup is checking updates for component cluster …
A new version of cluster is available:
The latest version: v1.11.0
Local installed version: v1.10.3
Update current component: tiup update cluster
Update all components: tiup update --all
Execute this to check the version: tiup cluster list
.
The reason for asking about the version is that in some versions, if the log level is set to error, slow queries will not be counted.
Additionally, execute this to check the threshold for slow query statistics:
show VARIABLES where variable_name = 'tidb_slow_log_threshold';
The image is not visible. Please provide the text you need translated.
Execute this in the database and see, what is the log level:
show config where name in (‘log.level’,‘log-level’);
The image you provided is not accessible. Please provide the text content you need translated.
Change the quotation marks to English ones.
The default value of tidb_gc_life_time
is 10m, which means that data older than 10 minutes will be cleaned up. You can adjust this parameter according to your needs.
Querying this log level took 30 seconds, so slow.
I just checked, and it does include your version. However, I’m not sure if you have set the log level on your side. Additionally, execute this statement to check the statistical threshold:
show VARIABLES where variable_name = 'tidb_slow_log_threshold';
The image you provided is not accessible, so I cannot translate its content. Please provide the text you need translated.
This is the normal default value, 300ms.
Suddenly noticed, you are talking about the slow query of that file, does it need to reach a certain size to record a new file? Pay attention to the last modification time of the file.
Additionally, this statement can query today’s slow queries:
SELECT * FROM INFORMATION_SCHEMA.CLUSTER_SLOW_QUERY
WHERE time BETWEEN ‘2022-09-27 00:00:00’ AND ‘2022-09-28 00:00:00’
This query has been running for several minutes, but I still haven’t gotten any results.
The cluster response is a bit slow, so let’s add a limit 1.
The query result is empty.
That means there are indeed no statements being executed that exceed 300ms.
Execute select sleep(1)
to see if it gets recorded.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.