How to Set Slow Queries to Not Record Analyze Operations

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

Original topic: 如何设置慢查询不记录 analyze 操作

| username: 梦想是个厨子

How can I set slow queries to not display the analyze table operation? The graphical interface is now full of this, making it very slow to open.

| username: weixiaobing | Original post link

You can filter keywords.

| username: 梦想是个厨子 | Original post link

Is it filtering here? It directly freezes. Does your slow query page behave like this?

| username: weixiaobing | Original post link

Are there many slow queries? You can either select some databases or directly check some slow queries on the server.

| username: 梦想是个厨子 | Original post link

Not much, it will freeze. Several clusters are like this.

| username: weixiaobing | Original post link

Is the version v6.1.6? What is the memory usage of the PD node? If it’s very low, theoretically it shouldn’t be an issue.

| username: 梦想是个厨子 | Original post link

v6.1.0

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

Is the table SELECT * FROM INFORMATION_SCHEMA.CLUSTER_SLOW_QUERY very large?

| username: 梦想是个厨子 | Original post link

| count(*) |
±---------+
| 12672 |
±---------+

count(*) 12672

| username: 裤衩儿飞上天 | Original post link

If it’s lagging, it’s because you have too many slow log files. You can delete or remove the old slow log files (on all TiDB nodes).

| username: 梦想是个厨子 | Original post link

Is there a way to not log the analyze operation?

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

Why is it slow with such a small size? Check the file size. SHOW VARIABLES LIKE ‘%tidb_slow_query_file%’; Find the file location and take a look.

| username: Kongdom | Original post link

Is it possible to adjust the time range for automatic analyze so that it does not run during peak business hours?

| username: 梦想是个厨子 | Original post link

One is 48M, the other is 18M.

| username: 梦想是个厨子 | Original post link

This seems a bit unreliable. Did you set it up this way?

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

Are your other pages lagging? Why is my log file much larger than yours, but I don’t feel any lag?

| username: 裤衩儿飞上天 | Original post link

Archived slow logs should also be included, such as: tidb_slow_query-2023-02-06T01-03-31.728.log

Check if it’s very large, and also check all TiDB nodes.

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

He only looks at it for three hours, it’s unlikely he’ll need to use the archived logs…

| username: 裤衩儿飞上天 | Original post link

I haven’t gone through the specific source code. What I encountered before was that as long as a specific time is specified, it seems to scan all the slow log files (including those that have been archived). The default page also does this.

| username: Kongdom | Original post link

We have set the automatic analyze to run from 10 PM after closing to 8 AM before opening, and it does not run during business hours. Although we are also online, nighttime is not a peak business period, so we perform the automatic analyze at night. Of course, this should be configured according to the characteristics of your own business.