【 TiDB 使用环境】生产环境
【 TiDB 版本】v8.1.0
【复现路径】
【遇到的问题】
今日凌晨0点左右(6月13日)对tidb做了版本升级,从v6.5.0 升级到了 v8.1.0,不停机升级。
升级过程一切正常,没有任何报错信息,升级完成后,连接正常,各系统也运行稳定。
早上在Dashboard上观察慢查询时,发现多了一个奇怪的慢查询。
语句就一个分号“;”,而且过10几分钟就执行一次,最多内存也忽大忽小。基本信息里也不显示执行数据库、执行用户名和客户端地址。
查询了INFORMATION_SCHEMA的CLUSTER_SLOW_QUERY,这个语句是升级完后才出现的,升级前慢查询里没有这个语句。
这是数据库自动执行的吗?这个现象正常吗?
【附件:截图/日志/监控】
看索引名这一行,有一个tidb_background_subtask:idx_exec_id,是不是数据库的后台子任务,在做索引优化
idx_exec_id:这部分可能与索引执行有关。它可能是用于标识某个特定索引创建、修改或删除操作的标识符
Kongdom
(Kongdom)
2024 年6 月 13 日 05:46
4
只有一个分号,然后执行计划里还有HashJoin?能发一下完整的执行计划么?
“;”这样的sql大概有六十多条慢sql记录,大部分记录里都没有执行计划。
看警告这一栏里,好多都是类似如下信息
Analyze use auto adjusted sample rate 0.034xxx for db.table_name,reason to use this rate is "Row count is stats_meta is smaller compared with the row count got by PD,use min(1,15000/4.385493e+06) as the sample-rate=0.034xxxxxx"
猜测应该是数据库本身的一些分析任务,执行完之后,今天下午没有再出现在慢查询里了。
林夕一指
(林夕一指)
2024 年6 月 13 日 09:33
6
看着内容像是收集统计信息的,可是我咋记得统计信息的后台任务是sql的呀就一个;着实不知道
Kongdom
(Kongdom)
2024 年6 月 14 日 01:24
8
比如这个执行计划,会不会是sql太长,然后sql里有换行,截断之后就只有换行的分号了
ziptoam
(Ti D Ber D1q T Ff Sk)
2024 年6 月 15 日 02:35
12
这个问题很奇怪,即使是索引或者分析等数据库自身产生的任务,也不合适用这种不严谨的表现方式
h5n1
(H5n1)
2024 年6 月 15 日 09:34
15
从“是否为内部SQL查询“的值为1,这里的信息可以知道是tidb集群内部的语句,是集群自身的问题,非业务侧SQL。
解决方法如前面大佬提到的issue链接,等官方修复后再调整下,保持关注。
opened 10:52AM - 14 May 24 UTC
type/bug
sig/diagnosis
## Bug Report
Please answer these questions before submitting your issue. Tha… nks!
### 1. Minimal reproduce step (Required)
```sql
set @@tidb_slow_log_threshold=0;
```
<img width="2105" alt="image" src="https://github.com/pingcap/tidb/assets/26020263/d6320e64-6a75-4b6c-b724-6a15b6150fb0">
related slow log:
```log
# Time: 2024-05-14T10:46:16.744456542Z
# Txn_start_ts: 449756151429201928
# Query_time: 15.671098186
# Parse_time: 0
# Compile_time: 0.001440327
# Rewrite_time: 0.00028654
# Optimize_time: 0.000975736
# Wait_TS: 0.000020672
# Cop_time: 15.669230206 Process_time: 0.000263148 Wait_time: 0.000087955 Backoff_time: 15.588 Request_count: 2 Total_keys: 36 Get_snapshot_time: 0.000 Rocksdb_key_skipped_count: 32 Rocksdb_block_cache_hit_count: 28
# Index_names: [tidb_background_subtask:idx_exec_id,tidb_global_task:state]
# Is_internal: true
# Digest: 8e00fe5c3677d581b104159ff91d824e3be8160c4e4be058288db681abd1a134
# Stats: tidb_global_task:pseudo[10000;0],tidb_background_subtask:pseudo[10000;0]
# Num_cop_tasks: 2
# Cop_proc_avg: 0.000131574 Cop_proc_p90: 0.000189195 Cop_proc_max: 0.000189195 Cop_proc_addr: 192.168.180.13:23360
# Cop_wait_avg: 4.3977e-05 Cop_wait_p90: 4.5169e-05 Cop_wait_max: 4.5169e-05 Cop_wait_addr: 192.168.180.13:23360
# Cop_backoff_regionMiss_total_times: 35 Cop_backoff_regionMiss_total_time: 14.01 Cop_backoff_regionMiss_max_time: 14.01 Cop_backoff_regionMiss_max_addr: 192.168.180.13:23360 Cop_backoff_regionMiss_avg_time: 14.01 Cop_backoff_regionMiss_p90_time: 14.01
# Cop_backoff_regionScheduling_total_times: 10 Cop_backoff_regionScheduling_total_time: 1.51 Cop_backoff_regionScheduling_max_time: 1.51 Cop_backoff_regionScheduling_max_addr: 192.168.180.13:23360 Cop_backoff_regionScheduling_avg_time: 1.51 Cop_backoff_regionScheduling_p90_time: 1.51
# Cop_backoff_tikvRPC_total_times: 1 Cop_backoff_tikvRPC_total_time: 0.068 Cop_backoff_tikvRPC_max_time: 0.068 Cop_backoff_tikvRPC_max_addr: 192.168.180.13:23360 Cop_backoff_tikvRPC_avg_time: 0.068 Cop_backoff_tikvRPC_p90_time: 0.068
# Mem_max: 17016
# Prepared: false
# Plan_from_cache: false
# Plan_from_binding: false
# Has_more_results: false
# KV_total: 0
# PD_total: 0
# Backoff_total: 0
# Write_sql_response_total: 0
# Result_rows: 0
# Warnings: [{"Level":"Note","Message":"[st,idx_exec_id] remain after pruning paths for st given Prop{SortItems: [], TaskTp: rootTask}","IsExtra":true},{"Level":"Note","Message":"[t,state] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}","IsExtra":true}]
# Succ: true
# IsExplicitTxn: false
# IsSyncStatsFailed: false
# Plan: tidb_decode_plan('gSawMAkxNF8xMwkwCTEJbXlzcWwudGlkYl9nbG9iYWxfdGFzay5wcmlvcml0eSwgWiEAKGNyZWF0ZV90aW1lYiQAEGlkCTAJASJYOjE1LjdzLCBsb29wczoxCTAgQnl0ZXMRCBgKMQkzXzE1bpAADGlkLCBaigABsAxfa2V5ZiEABHlwZqQADHN0YXRuHgAEZXBiWACGJAEgb25jdXJyZW5jZp0AjkgBJHRhcmdldF9zY28ByRxDb2x1bW4jMyEwSl0BCCwgQxl3WDpPRkYJNC43MSBLQglOL0EKMgk2XzE2JWogZ3JvdXAgYnk6WlgBIXMkZnVuY3M6bWF4KB0lDGJhY2sBPRRuZF9zdWIhfwAuHeoIKS0+FaIALA1BHGZpcnN0cm93LkYAL
m4CEGlkKS0+HWI2HACeRgABikEJZkwAESKiUgAIeXBlak4ARVgpI37iAEVnZksABR+elgBReGZPABEinlIAXYVmVQAdJaJYAFmKalgAGSWeWAAMc3RlcGZRAAEenkoALlsDZlIALiYAVtMEVCwgcGFydGlhbF93b3JrZX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LCASPAoYbmFwc2hvdKmcCCAxNg2lNHJvY2tzZGI6IHtibG9jIToZ7CBjb3VudDogNH0JgARtZT5iACE8CGVzcw1UOUTBXARhaRFsNUsFw/kXDCAyNzcFhrn1MDcJMV8yNyhQcm9iZSlFbKX+BGluejYDQSBIZSwgInBlbmRpbmciLCAicnVubgELMCksIG5vdChpc251bGyCRwAIZXApYf1B+gEEHAo4CTQ1XzI2BYsy9wKCpAIBPwEEiVkAORHUGDAJMjkuOTcuWgQ+7QqddS4bAJkaXiEAEo8KWh0ALSJaHgD+0Qb+0QZO0QY+LQUuDAHh+F4gBQ7dDGUiNnQORh0FDDQuMzQeFw2lHQU7KZ+RZTZEAAwJMjUzPhsFBDMzLhsFADOxG7UaJXkAKAUGvRIMcGF1c0GeACwVCihdLCBbInJldmVydAkZGQwJG03QACxV2qIqBTbFAGYnBRA2MjcuN4W7YdmNQDInBQgxODmtSSILCgggNDUNEwBjvioFBDI5BW3OKAUENjQyKQUIMzNtDtcKoVU4ZXJyb3JzOntub3RfbGVhwUUENjKBBBQgYXZhaWwOJwgO4wokbmVjdGlvbnM6MYHd4bkMb2Zme4GiXFJQQzogNjhtcywgcmVnaW9uTWlzczogMQ5fCwkRPFNjaGVkdWxpbmc6IDEuNTEBewE6Lp8FADEBQI6gBQQzNVahBQA0pfoALL2hKGtleV9za2lwcGVksZsMMzIsIGK4BQAynrkFMtYBOrwFMd0AdA5ZCRxfa3ZfcmVhZC7FBQXpBf692gwzMTMuId022gUEMzWxBg5GCGlpVpwFLuwDEhwKRpUFBDM0BUYucQOmlAU=')
# Plan_digest: 19251e4d0852c3daee269dcb983554a856b9ab56b15a27ac9c282faeeb7e2e53
# Binary_plan: tidb_decode_binary_plan('winACr0pCgdTb3J0XzEzEqYoCg1Qcm9qZWN0aW9uXzE1EpwlCgpIYXNoQWdnXzE2EskbCjIhABQ4Ep8YCgsBISRKb2luXzIwEv0JMkMAZDIxEoMICg5JbmRleExvb2tVcF8yOBKUBQoRBRNAUmFu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ADZrAAgpLT6ChwB+RgCRuWZMABEinpgAgepqTgClCCkjfpwApRdmSwAFH56WALFFZk8AESKeUgC9dmZVAB0lolgAJkMLalgAGSWeWACF3WIyAgEenkoAAHTdC2ZSAC4mAFaEAxjGAnBhcnRpDgAJGG9ya2VyOnsm0QgoMTUuNjY4OTA2NzMODwod8Aw6NSwgRZQOVxAaORASKBA4MW0xOC4zNDQyODExNjNzErAKAF8OCRESnw8OQAsWngsVJxA1NTk0cxaXEAlvLDg2MDAxMnMsIHA5NTYTABR9LCBmaW5SqgAO/A9enwABqwRvdAmfEDg4LjQ0DkIQHZkMMTkxbg0QMpwAEDUwNzM1DkQMCG1heA2JEDkxNTM4ARMZnA0TWvMJGCE0Dc5I1uQ+xAQAq/5cBv5cBjpcBkl5WsgEeZRaIQA9eWb7CIofCS6tAvn0ADVWuAJ6PAYUkscXVdj8PngBAF5awgCG4wCKvwAEaWRSqgAEGAE=')
# Resource_group: default
;
```
### 2. What did you expect to see? (Required)
### 3. What did you see instead (Required)
### 4. What is your TiDB version? (Required)
nightly: 4b91fee6af2b1859d223670130e5c8bf3f400026
opened 02:06AM - 19 Apr 24 UTC
type/bug
sig/sql-infra
severity/major
may-affects-5.4
may-affects-6.1
may-affects-6.5
may-affects-7.1
may-affects-7.5
affects-8.1
## Bug Report
Please answer these questions before submitting your issue. Tha… nks!
### 1. Minimal reproduce step (Required)
Unknown. This seems to be an internal SQL.
### 2. What did you expect to see? (Required)
Slow query should display the query text.
### 3. What did you see instead (Required)
<img width="878" alt="image" src="https://github.com/pingcap/tidb/assets/31720476/ded13398-f5e0-4c5e-8e26-f5a3a3358a04">
The query text is empty.
### 4. What is your TiDB version? (Required)
master(8d9e67b37dea759db0980aeddf4da967bf93e83e)