统计范围:2026-09-01 00:00:00 ~ 23:59:59(Asia/Shanghai,UTC+8),环境 staging
数据来源:ES 慢日志索引(@timestamp,UTC 换算 [2026-09-01T00:00:00+08:00, 2026-09-02T00:00:00+08:00)),经 MCPes_slow_logs工具获取,Top 10 按耗时降序
生成时间:2026-09-02 10:0X +08:00 | 分析工具全程只读(connect / describe_schema / count_estimate / explain,未执行任何写操作、DDL 或 KILL)
| 指标 | 值 |
|---|---|
| 昨日慢查询总数 | 1,350 条 |
| Top10 耗时区间 | 300.00s ~ 1,125.29s |
| 涉及实例 | staging/tw8591(192.168.8.27:3306)、staging/hk8591(192.168.8.27:3307) |
| 涉及库表 | t8_game.t8_embeddings_cache、game.t8_embeddings_cache、hk8591.h8_telescope_entries、t8_extends.telescope_entries |
| 慢因分布 | 备份全表扫描大结果集 3 条(Top1~3);锁等待超时 7 条(Top4~10,telescope_entries INSERT 恰好卡在 ~300.00s 阈值) |
总体结论:昨日无业务 SELECT 缺索引类慢查询进入 Top10。Top3 均为 backup 账号(mysqldump,SQL_NO_CACHE)对宽行 JSON/longtext 表的全表导出,属于备份代价问题;Top4~10 全部是 Laravel Telescope 写入 t8_extends.telescope_entries 的 INSERT 恰好停在 ~300.00 秒(Lock_time 为 0、rows 为 0),是典型的锁等待超时(innodb_lock_wait_timeout=300s)特征,且多条与备份窗口(01:29~01:30 备份同一实例)重叠。
| # | 耗时(s) | 库.表 | SQL 摘要 | 用户/来源 | Rows examined/sent | 慢因类型 |
|---|---|---|---|---|---|---|
| 1 | 1,125.29 | t8_game.t8_embeddings_cache | SELECT /*!40001 SQL_NO_CACHE */ * FROM ...(mysqldump 全表导出) | backup @192.168.8.82 | 79,835 / 79,835 | 大结果集传输(全表扫描+JSON 宽行) |
| 2 | 814.76 | game.t8_embeddings_cache | 同上 mysqldump 全表导出 | backup @192.168.8.82 | 55,291 / 55,291 | 大结果集传输(全表扫描+JSON 宽行) |
| 3 | 300.61 | hk8591.h8_telescope_entries | mysqldump 全表导出 | backup @192.168.8.27 | 191,431 / 191,431 | 大结果集传输(longtext 宽行,~127MB/全表) |
| 4 | 300.00 | t8_extends.telescope_entries | INSERT INTO telescope_entries (batch_id, content, ...) | a8591 @192.168.8.82 | 0 / 0 | 锁等待(恰卡 ~300.00s 超时阈值) |
| 5 | 300.00 | t8_extends.telescope_entries | INSERT(同上,SocialiteWasCalled 事件) | a8591 @192.168.8.82 | 0 / 0 | 锁等待 |
| 6 | 300.00 | t8_extends.telescope_entries | INSERT(同上) | a8591 @192.168.8.82 | 0 / 0 | 锁等待 |
| 7 | 300.00 | t8_extends.telescope_entries | INSERT(同上,RequestWasMatched 事件) | a8591 @192.168.8.82 | 0 / 0 | 锁等待 |
| 8 | 300.00 | t8_extends.telescope_entries | INSERT(同上,uuid 重复出现,疑似重试) | a8591 @192.168.8.82 | 0 / 0 | 锁等待(含重复 uuid 重试风暴特征) |
| 9 | 300.00 | t8_extends.telescope_entries | INSERT(同上) | a8591 @192.168.8.82 | 0 / 0 | 锁等待 |
| 10 | 300.00 | t8_extends.telescope_entries | INSERT(同上) | a8591 @192.168.8.82 | 0 / 0 | 锁等待 |
t8_embeddings_cache(1,125s / 815s)key varchar(255) PK + vector json NOT NULL + expired datetime,仅主键索引;行数估算 t8_game 库 ~70,796 行、game 库 ~44,105 行。access_type=ALL 全表扫描,data_read_per_join 约 70MB / 43MB(每行含整段 JSON 向量,宽行)。--ignore-table 排除,或改用可增量方式;staging 环境尤其如此。vector json 建议改存外部向量库/对象存储,表中只留引用,可同时大幅缩小备份与查询代价。hk8591.h8_telescope_entries(300.61s)content longtext,AUTO_INCREMENT 已达 11.5 亿、实际行数 ~127,596 → 历史写入/清理量极大。data_read_per_join ~127MB(longtext 宽行)。INSERT INTO t8_extends.telescope_entries 锁等待超时(各 ~300.00s)sequence PK、uuid UNIQUE、batch_id/type+should_display/family_hash 普通索引;实际行数仅 ~10,281,但 AUTO_INCREMENT 已达 2.3 亿 → 高频写入+清理。batch_id 条件走 telescope_entries_batch_id_index(ref,1 行),说明读路径索引正常,问题不在缺索引。innodb_lock_wait_timeout=300 锁等待超时;慢日志记录的 lock_time 只含表级锁,行锁等待时间体现在 Query_time。uuid/batch_id 重复出现(如 a2a2ac6c-... 出现 3 次),是超时后应用重试、进一步加剧竞争的风暴特征。实例隔离级别为 REPEATABLE-READ,UNIQUE(uuid) 插入冲突时 next-key 锁易互锁。TELESCOPE_ENABLED=false 或只记录异常请求),从源头消灭这批 INSERT。innodb_lock_wait_timeout 在 staging 调小(如 30s)以快速失败,避免连接被拖 300s。es_slow_logs(http://192.168.8.75:8200/mcp),start=2026-09-01T00:00:00+08:00、end=2026-09-02T00:00:00+08:00、top=10、env=staging,命中 total=1,350。connect → describe_schema / count_estimate / explain → disconnect,全程只读(staging/tw8591、staging/hk8591)。