No Slow Query Log Records for the Day in TiDB Cluster - tidb_slow_query.log

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

Original topic: tidb集群无当天慢查询日志记录-tidb_slow_query.log

| username: TiDBer_vJpITQ5J

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?

| username: Kongdom | Original post link

What version of TiDB is it?

| username: TiDBer_vJpITQ5J | Original post link

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

| username: Kongdom | Original post link

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';

| username: TiDBer_vJpITQ5J | Original post link

The image is not visible. Please provide the text you need translated.

| username: Kongdom | Original post link

Execute this in the database and see, what is the log level:
show config where name in (‘log.level’,‘log-level’);

| username: TiDBer_vJpITQ5J | Original post link

The image you provided is not accessible. Please provide the text content you need translated.

| username: Kongdom | Original post link

Change the quotation marks to English ones.

| username: TiDBer_vJpITQ5J | Original post link

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.

| username: TiDBer_vJpITQ5J | Original post link

Querying this log level took 30 seconds, so slow.

| username: Kongdom | Original post link

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';
| username: TiDBer_vJpITQ5J | Original post link

The image you provided is not accessible, so I cannot translate its content. Please provide the text you need translated.

| username: Kongdom | Original post link

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’

| username: TiDBer_vJpITQ5J | Original post link

I changed it to 200.

| username: TiDBer_vJpITQ5J | Original post link

This query has been running for several minutes, but I still haven’t gotten any results.

| username: Kongdom | Original post link

:thinking: The cluster response is a bit slow, so let’s add a limit 1.

| username: TiDBer_vJpITQ5J | Original post link

The query result is empty.

| username: Kongdom | Original post link

:thinking: That means there are indeed no statements being executed that exceed 300ms.

| username: 特雷西-迈克-格雷迪 | Original post link

Execute select sleep(1) to see if it gets recorded.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.