| 指标 | 值 |
|---|---|
| 统计时间范围 | 2026-08-30 00:00:00 ~ 23:59:59(Asia/Shanghai) |
| 环境 | staging |
| 涉及实例 | LANaddcn27(192.168.8.27:3306 / 3307,staging/tw8591 & staging/hk8591) |
| Top 慢查询数 | 10 |
| 最长耗时 | 1130.29 秒(约 18.8 分钟) |
| 主要慢因分布 | 大结果集传输 2 条;锁等待/300s 超时阈值 8 条 |
| 主要来源 | 备份任务(user=backup, 192.168.8.82)2 条;应用写入(Laravel Telescope、embeddings 写入)8 条 |
核心结论:
mysqldump 对 t8_game.t8_embeddings_cache(79,835 行 JSON 向量宽行)和 game.t8_embeddings_cache(55,291 行)执行 SELECT /*!40001 SQL_NO_CACHE */ *,分别耗时 1130s / 797s,属于大结果集传输,非索引问题。telescope_entries INSERT(Laravel Telescope 调试组件,自增已到 2.3 亿)与 t8_platform_game_embeddings INSERT,Query_time 均为 300.00x 秒、Lock_time 为 0,典型为 innodb_lock_wait_timeout=50×重试或连接被 wait_timeout/事务挂起阻塞所致——即应用侧长事务/未提交事务持有锁,写入等待至超时。| # | Query_time(s) | Lock_time(s) | Rows_sent | Rows_examined | 用户 | 库 | 涉及表 | 慢因类型 |
|---|---|---|---|---|---|---|---|---|
| 1 | 1130.293 | 0.000179 | 79,835 | 79,835 | backup | t8_yy | t8_game.t8_embeddings_cache | 大结果集传输 |
| 2 | 797.057 | 0.000469 | 55,291 | 55,291 | backup | a8591 | game.t8_embeddings_cache | 大结果集传输 |
| 3 | 300.009 | 0 | 0 | 0 | 8591 | a8591 | (Prepare 命令) | 锁等待/超时阈值 |
| 4 | 300.003 | 0 | 0 | 0 | a8591 | t8_extends | telescope_entries | 锁等待/超时阈值 |
| 5 | 300.003 | 0 | 0 | 0 | a8591 | t8_extends | telescope_entries | 锁等待/超时阈值 |
| 6 | 300.003 | 0 | 0 | 0 | a8591 | t8_extends | telescope_entries | 锁等待/超时阈值 |
| 7 | 300.003 | 0 | 0 | 0 | a8591 | t8_extends | telescope_entries | 锁等待/超时阈值 |
| 8 | 300.003 | 0 | 0 | 0 | 8591 | a8591 | (Prepare 命令) | 锁等待/超时阈值 |
| 9 | 300.003 | 0 | 0 | 0 | a8591 | t8_extends | telescope_entries | 锁等待/超时阈值 |
| 10 | 300.002 | 0 | 0 | 0 | 8591 | t8_game | t8_platform_game_embeddings | 锁等待/超时阈值 |
注:全部来自同一主机 LANaddcn27(192.168.8.27),客户端均为 192.168.8.82。
t8_embeddings_cache(1130s / 797s)表结构(describe_schema 实测):
CREATE TABLE `t8_embeddings_cache` (
`key` varchar(255) NOT NULL COMMENT 'embeddings 明文唯一标识',
`vector` json NOT NULL COMMENT '向量数据',
`expired` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
--single-transaction --quick --skip-lock-tables 减少锁影响。key 为 varchar(255) 主键偏宽,若可缩短(如 md5 32 位或前缀索引)可减小整表体积。--ignore-table)或改由源数据重建,直接省去 18 分钟。expired),控制行数。# administrator command: Prepare 卡 300sinnodb_lock_wait_timeout 与应用重试策略叠加导致的整数倍等待。telescope_entries INSERT 卡 300s表结构(实测,自增 AUTO_INCREMENT≈2.3 亿):
CREATE TABLE `telescope_entries` (
`sequence` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` char(36) NOT NULL,
`batch_id` char(36) NOT NULL,
`family_hash` varchar(255) DEFAULT NULL,
`should_display_on_index` tinyint(1) NOT NULL DEFAULT '1',
`type` varchar(20) NOT NULL,
`content` longtext NOT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`sequence`),
UNIQUE KEY `telescope_entries_uuid_unique` (`uuid`),
KEY `telescope_entries_batch_id_index` (`batch_id`),
KEY `telescope_entries_type_should_display_on_index_index` (`type`,`should_display_on_index`),
KEY `telescope_entries_family_hash_index` (`family_hash`)
) ENGINE=InnoDB
batch_id/uuid 前缀 a29ea669/a29ea672/a29ea71c 反复出现)在并发/重试下互相等待,或被其它长事务阻塞至 300s 超时。TELESCOPE_ENABLED=false),可消掉 6/10 条慢查询并停止该表无限膨胀(已 2.3 亿行)。telescope:prune),content 为 longtext 大字段,表已过大。t8_platform_game_embeddings INSERT 卡 300s表结构(实测):
CREATE TABLE `t8_platform_game_embeddings` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`platform_game_id` bigint(20) NOT NULL DEFAULT '0',
`vector` json DEFAULT NULL,
`name_vector` json DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_platform_game_id` (`platform_game_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=13851208
INSERT ... ON DUPLICATE/重试场景,platform_game_id 唯一键冲突会等锁。INSERT ... ON DUPLICATE KEY UPDATE 显式处理,避免依赖应用重试。innodb_lock_wait_timeout(50s)× 6 次重试的累积,应在应用侧将重试上限与间隔调小并加退避。mysql_slow-*,按 @timestamp 过滤 UTC [2026-08-29T16:00:00Z, 2026-08-30T16:00:00Z)),经 MCP es_slow_logs 工具(http://192.168.8.75:8200/mcp,top=10,env=staging)获取;表结构与执行计划经 MCP describe_schema / explain(staging/tw8591)只读分析。