MySQL 慢查询日报(线上 prod8891)2026-11-04
统计概览
| 项目 | 值 |
|---|
| 统计范围 | 2026-11-04 00:00:00 ~ 23:59:59(Asia/Shanghai) |
| 环境 | prod-8891 |
| 慢日志条数(ES mysql-slow_*) | 18,186 条(指纹聚合取样 18,186 条) |
| Top10 单条最慢 | 298.69 s(user=t8891,YCJF_t8891_24) |
| 非备份模式最大累计 | 5.76h(3736 次 × 5.55 s) |
| 备份模式(user 含 backup/databasus_backup) | 0 条、累计 0.0s(单独标注,不触发深析) |
| 深析模式 explain 成功率 | 8/8(100%) |
| 数据来源 | ES mysql-slow_*(@timestamp)+ MCP 只读 MySQL(describe_schema/explain) |
| 生成时间 | 2026-11-05 09:31(Asia/Shanghai) |
Top10 明细(按单条耗时)
| # | 耗时(s) | 库.表 | 行数 sent/examined | user / server | 慢因分类 |
|---|
| 1 | 298.69 | t8891.t_carinfo_coupon_activity | 2,095 / 658,044 | t8891 / YCJF_t8891_24 | 扫描行数远大于返回行数(658,044/2,095) |
| 2 | 296.15 | t8891.t_carinfo_coupon_activity | 2,094 / 658,046 | t8891 / YCJF_t8891_26 | 扫描行数远大于返回行数(658,046/2,094) |
| 3 | 291.75 | t8891.t_carinfo_coupon_activity | 2,095 / 658,425 | t8891 / YCJF_t8891_25_3307 | 扫描行数远大于返回行数(658,425/2,095) |
| 4 | 291.45 | t8891.t_carinfo_coupon_activity | 2,094 / 658,055 | t8891 / YCJF_t8891_26 | 扫描行数远大于返回行数(658,055/2,094) |
| 5 | 291.08 | t8891.t_carinfo_coupon_activity | 2,095 / 658,425 | t8891 / YCJF_t8891_25 | 扫描行数远大于返回行数(658,425/2,095) |
| 6 | 289.77 | t8891.t_carinfo_coupon_activity | 2,094 / 658,044 | t8891 / YCJF_t8891_26 | 扫描行数远大于返回行数(658,044/2,094) |
| 7 | 288.31 | t8891.t_carinfo_coupon_activity | 2,094 / 658,055 | t8891 / YCJF_t8891_25 | 扫描行数远大于返回行数(658,055/2,094) |
| 8 | 286.85 | t8891.t_carinfo_coupon_activity | 2,095 / 658,044 | t8891 / YCJF_t8891_25 | 扫描行数远大于返回行数(658,044/2,095) |
| 9 | 286.35 | t8891.t_carinfo_coupon_activity | 2,094 / 658,042 | t8891 / YCJF_t8891_25_3307 | 扫描行数远大于返回行数(658,042/2,094) |
| 10 | 284.85 | t8891.t_carinfo_coupon_activity | 2,095 / 658,044 | t8891 / YCJF_t8891_26 | 扫描行数远大于返回行数(658,044/2,095) |
高频慢查询模式(指纹聚合,取样 18,186 条)
按条数 Top5
| # | 模式(指纹摘要) | 条数 | 平均(s) | 累计 | server | user |
|---|
| 1 | select * from t_member_devices where (m_id = ? and hash = ?) limit ?; | 3,736 | 5.55 | 5.76h | YCJF_t8891_24,YCJF_t8891_25,YCJF_t8891_2 | t8891 |
| 2 | select * from t_carinfo_inquiry_agent where expire_status = ? and expire_time <= ?; | 1,440 | 1.91 | 45.9min | YCJF_t8891_24 | t8891 |
| 3 | select max(record_time) as aggregate from t_carinfo_inquiry_call_log; | 1,430 | 1.19 | 28.4min | YCJF_t8891_24 | t8891 |
| 4 | select * from t_carinfo_inquiry_agent where contact_status = ? and expire_status = ?; | 1,288 | 1.94 | 41.7min | YCJF_t8891_24,YCJF_t8891_25,YCJF_t8891_2 | t8891 |
| 5 | select f_id, COUNT(*) count from t_carinfo_favorite where m_id IN (?...) and type = ? and exists (select * from t_carinfo_search_base_kind where t_carinfo_favorite.f_id = t_carinfo_search_base_kind.kind_id and sale_stop = ?) group by f_id order by count desc limit ?; | 1,241 | 5.03 | 1.74h | YCJF_t8891_24,YCJF_t8891_25,YCJF_t8891_2 | t8891 |
按累计耗时 Top5
| # | 模式 | 条数 | 平均(s) | 累计 | server | user |
|---|
| 1 | select * from t_member_devices where (m_id = ? and hash = ?) limit ?; | 3,736 | 5.55 | 5.76h | YCJF_t8891_24,YCJF_t8891_25,YCJF_t8891_2 | t8891 |
| 2 | select t_carinfo_coupon_activity.* from t_carinfo_coupon_activity left join t_carinfo_coupon_activity_callback as b on t_carinfo_coupon_activity.id = b.activity …(点击展开完整 SQL)select t_carinfo_coupon_activity.* from t_carinfo_coupon_activity left join t_carinfo_coupon_activity_callback as b on t_carinfo_coupon_activity.id = b.activity_item_id left join t_carinfo_agent_call_to_bidding as c on t_carinfo_coupon_activity.m_id = c.m_id and c.type = ? and phase = ? and c.created_at > ? where (t_carinfo_coupon_activity.type = ?) and b.payment_time is null and t_carinfo_coupon_activity.m_id > ? and c.id is null; | 23 | 282.89 | 1.81h | YCJF_t8891_24,YCJF_t8891_25,YCJF_t8891_2 | t8891 |
| 3 | select f_id, COUNT(*) count from t_carinfo_favorite where m_id IN (?...) and type = ? and exists (select * from t_carinfo_search_base_kind where t_carinfo_favorite.f_id = t_carinfo_search_base_kind.kind_id and sale_stop = ?) group by f_id order by count desc limit ?; | 1,241 | 5.03 | 1.74h | YCJF_t8891_24,YCJF_t8891_25,YCJF_t8891_2 | t8891 |
| 4 | select * from t_carinfo_inquiry_agent where expire_status = ? and expire_time <= ?; | 1,440 | 1.91 | 45.9min | YCJF_t8891_24 | t8891 |
| 5 | select * from t_carinfo_inquiry_agent where contact_status = ? and expire_status = ?; | 1,288 | 1.94 | 41.7min | YCJF_t8891_24,YCJF_t8891_25,YCJF_t8891_2 | t8891 |
备份模式全天 0 条 / 0.0s,未触发深度分析(如条数环比异常翻倍再人工介入)。
触发深度分析的模式(条数>100 或 累计>30min,非备份,最多 8 个)
1. select * from t_member_devices where (m_id = ? and hash = ?) limit ?; —— 3,736 次 × 5.55s = 5.76h
select * from `t_member_devices` where (`m_id` = 342660 and `hash` = '42dd69f51002a2c1502cabc206c55a09') limit 1;
- 库表:t8891.t_member_devices;实例 alias:
prod-8891/master
- explain SQL:
select * from `t8891`.`t_member_devices` where (`m_id` = 342660 and `hash` = '42dd69f51002a2c1502cabc206c55a09') limit 1;
- 执行计划(EXPLAIN 表节点,按 JOIN 顺序):
| # | 表 | 访问类型 | 使用索引 | 候选索引 | 预扫行数 | 过滤后 |
|---|
| 1 | t_member_devices | ref | t_member_devices_m_id_index | t_member_devices_m_id_index | 800,287 | 10.0% |
- 慢因:扫描行数远大于返回行数(3,830,703/0)
- 建议:补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中
- 可执行 DDL(建议先在低峰期 EXPLAIN 验证再执行):
ALTER TABLE `t8891`.`t_member_devices` ADD INDEX `idx_m_id_hash` (`m_id`, `hash`);
- DDL 注:
t_member_devices 与现有索引 t_member_devices_m_id_index(m_id) 前缀重复(m_id), 新索引生效后可评估删除旧索引
2. select t_carinfo_coupon_activity.* from t_carinfo_coupon_activity left join t_carinfo_coupon_activity_callback as b on t_carinfo_coupon_activity.id = b.activity —— 23 次 × 282.89s = 1.81h
select t_carinfo_coupon_activity.* from `t_carinfo_coupon_activity` left join `t_carinfo_coupon_activity_callback` as `b` on `t_carinfo_coupon_activity`.`id` = `b`.`activity_item_id` left join `t_carinfo_agent_call_to_bidding` as `c` on `t_carinfo_coupon_activity`.`m_id` = `c`.`m_id` and `c`.`type` = 'callback' and `phase` = 4 and `c`.`created_at` > 't_carinfo_coupon_activity.created_at' where (`t_carinfo_coupon_activity`.`type` = 4) and `b`.`payment_time` is null and `t_carinfo_coupon_activity`.`m_id` > 0 and `c`.`id` is null;
- 库表:t8891.t_carinfo_coupon_activity;实例 alias:
prod-8891/master
- explain SQL:
select t_carinfo_coupon_activity.* from `t8891`.`t_carinfo_coupon_activity` left join `t8891`.`t_carinfo_coupon_activity_callback` as `b` on `t_carinfo_coupon_activity`.`id` = `b`.`activity_item_id` left join `t8891`.`t_carinfo_agent_call_to_bidding` as `c` on `t_carinfo_coupon_activity`.`m_id` = `c`.`m_id` and `c`.`type` = 'callback' and `phase` = 4 and `c`.`created_at` > 't_carinfo_coupon_activity.created_at' where (`t_carinfo_coupon_activity`.`type` = 4) and `b`.`payment_time` is null and `t_carinfo_coupon_activity`.`m_id` > 0 and `c`.`id` is null;
- 执行计划(EXPLAIN 表节点,按 JOIN 顺序):
| # | 表 | 访问类型 | 使用索引 | 候选索引 | 预扫行数 | 过滤后 |
|---|
| 1 | t_carinfo_coupon_activity | ref | idx_type | idx_m_id,idx_type | 3,725 | 50.0% |
| 2 | b | ❌ 全表扫描 | — | — | 1,217 | 10.0% |
| 3 | c | ❌ 全表扫描 | — | — | 474,233 | 10.0% |
- 慢因:扫描行数远大于返回行数(658,425/2,095)、EXPLAIN 全表扫描/未用索引
- 建议:补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中
- 可执行 DDL(建议先在低峰期 EXPLAIN 验证再执行):
ALTER TABLE `t8891`.`t_carinfo_coupon_activity` ADD INDEX `idx_type_m_id` (`type`, `m_id`);
ALTER TABLE `t8891`.`t_carinfo_coupon_activity_callback` ADD INDEX `idx_activity_i_payment_ti` (`activity_item_id`, `payment_time`);
ALTER TABLE `t8891`.`t_carinfo_agent_call_to_bidding` ADD INDEX `idx_m_id_phase_type_created_at` (`m_id`, `phase`, `type`, `created_at`);
- DDL 注:
t_carinfo_coupon_activity 与现有索引 idx_type(type) 前缀重复(type), 新索引生效后可评估删除旧索引
3. select f_id, COUNT(*) count from t_carinfo_favorite where m_id IN (?...) and type = ? and exists (select * from t_carinfo_search_base_kind where t_carinfo_favor —— 1,241 次 × 5.03s = 1.74h
select f_id, COUNT(*) count from `t_carinfo_favorite` where `m_id` in (0) and `type` = 3 and exists (select * from `t_carinfo_search_base_kind` where `t_carinfo_favorite`.`f_id` = `t_carinfo_search_base_kind`.`kind_id` and `sale_stop` = 0) group by `f_id` order by `count` desc limit 6;
- 库表:t8891.t_carinfo_favorite;实例 alias:
prod-8891/master
- explain SQL:
select f_id, COUNT(*) count from `t8891`.`t_carinfo_favorite` where `m_id` in (0) and `type` = 3 and exists (select * from `t8891`.`t_carinfo_search_base_kind` where `t_carinfo_favorite`.`f_id` = `t_carinfo_search_base_kind`.`kind_id` and `sale_stop` = 0) group by `f_id` order by `count` desc limit 6;
- 执行计划(EXPLAIN 表节点,按 JOIN 顺序):
| # | 表 | 访问类型 | 使用索引 | 候选索引 | 预扫行数 | 过滤后 |
|---|
| 1 | t_carinfo_favorite | ref | m_id | m_id,f_id,type,m_id_type | 571,001 | 50.0% |
- 计划标志:⚠️ filesort 排序、⚠️ 产生临时表
- 慢因:扫描行数远大于返回行数(1,834,668/6)、DISTINCT/GROUP BY 产生临时表(大范围去重/聚合)、排序未走索引(filesort)
- 建议:补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; 缩小聚合/去重范围(补时间等过滤条件), 或预聚合到中间表/定时任务; 把 ORDER BY 列纳入复合索引, 或减小排序前扫描范围
- 可执行 DDL(建议先在低峰期 EXPLAIN 验证再执行):
ALTER TABLE `t8891`.`t_carinfo_favorite` ADD INDEX `idx_type_sale_stop_m_id_count` (`type`, `sale_stop`, `m_id`, `count`);
- DDL 注:
t_carinfo_favorite 与现有索引 type(type) 前缀重复(type), 新索引生效后可评估删除旧索引
4. select * from t_carinfo_inquiry_agent where expire_status = ? and expire_time <= ?; —— 1,440 次 × 1.91s = 45.9min
select * from `t_carinfo_inquiry_agent` where `expire_status` = 0 and `expire_time` <= '2026-11-04 10:00:12';
- 库表:t8891.t_carinfo_inquiry_agent;实例 alias:
prod-8891/master
- explain SQL:
select * from `t8891`.`t_carinfo_inquiry_agent` where `expire_status` = 0 and `expire_time` <= '2026-11-04 10:00:12';
- 执行计划(EXPLAIN 表节点,按 JOIN 顺序):
| # | 表 | 访问类型 | 使用索引 | 候选索引 | 预扫行数 | 过滤后 |
|---|
| 1 | t_carinfo_inquiry_agent | ❌ 全表扫描 | — | — | 1,898,633 | 3.33% |
- 慢因:扫描行数远大于返回行数(2,415,992/75)、EXPLAIN 全表扫描/未用索引
- 建议:补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中
- 可执行 DDL(建议先在低峰期 EXPLAIN 验证再执行):
ALTER TABLE `t8891`.`t_carinfo_inquiry_agent` ADD INDEX `idx_expire_sta_expire_tim` (`expire_status`, `expire_time`);
5. select * from t_carinfo_inquiry_agent where contact_status = ? and expire_status = ?; —— 1,288 次 × 1.94s = 41.7min
select * from `t_carinfo_inquiry_agent` where `contact_status` = 0 and `expire_status` = 0;
- 库表:t8891.t_carinfo_inquiry_agent;实例 alias:
prod-8891/master
- explain SQL:
select * from `t8891`.`t_carinfo_inquiry_agent` where `contact_status` = 0 and `expire_status` = 0;
- 执行计划(EXPLAIN 表节点,按 JOIN 顺序):
| # | 表 | 访问类型 | 使用索引 | 候选索引 | 预扫行数 | 过滤后 |
|---|
| 1 | t_carinfo_inquiry_agent | ❌ 全表扫描 | — | — | 1,898,633 | 1.0% |
- 慢因:扫描行数远大于返回行数(2,415,992/997)、EXPLAIN 全表扫描/未用索引
- 建议:补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中
- 可执行 DDL(建议先在低峰期 EXPLAIN 验证再执行):
ALTER TABLE `t8891`.`t_carinfo_inquiry_agent` ADD INDEX `idx_contact_st_expire_sta` (`contact_status`, `expire_status`);
6. select max(record_time) as aggregate from t_carinfo_inquiry_call_log; —— 1,430 次 × 1.19s = 28.4min
select max(`record_time`) as aggregate from `t_carinfo_inquiry_call_log`;
- 库表:t8891.t_carinfo_inquiry_call_log;实例 alias:
prod-8891/master
- explain SQL:
select max(`record_time`) as aggregate from `t8891`.`t_carinfo_inquiry_call_log`;
- 执行计划(EXPLAIN 表节点,按 JOIN 顺序):
| # | 表 | 访问类型 | 使用索引 | 候选索引 | 预扫行数 | 过滤后 |
|---|
| 1 | t_carinfo_inquiry_call_log | ❌ 全表扫描 | — | — | 1,658,600 | 100.0% |
- 慢因:扫描行数远大于返回行数(2,241,129/1)、EXPLAIN 全表扫描/未用索引
- 建议:补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中
- 可执行 DDL(建议先在低峰期 EXPLAIN 验证再执行):
ALTER TABLE `t8891`.`t_carinfo_inquiry_call_log` ADD INDEX `idx_record_tim` (`record_time`);
- DDL 注:MAX/MIN 聚合:
record_time 单列索引可让优化器走索引取极值, 亦可改写为 ORDER BY record_time DESC/ASC LIMIT 1
7. select t_vincheck_supervision.* from t_vincheck_supervision left join t_vincheck_supervision_info on t_vincheck_supervision_info.vincheck_supervision_id = t_vin —— 288 次 × 4.00s = 19.2min
select `t_vincheck_supervision`.* from `t_vincheck_supervision` left join `t_vincheck_supervision_info` on `t_vincheck_supervision_info`.`vincheck_supervision_id` = `t_vincheck_supervision`.`id` where `t_vincheck_supervision`.`is_exist` = 1 and `t_vincheck_supervision`.`type` = 1 and `t_vincheck_supervision_info`.`id` is null order by `t_vincheck_supervision`.`id` asc limit 500;
- 库表:t8891.t_vincheck_supervision;实例 alias:
prod-8891/master
- explain SQL:
select `t_vincheck_supervision`.* from `t8891`.`t_vincheck_supervision` left join `t8891`.`t_vincheck_supervision_info` on `t_vincheck_supervision_info`.`vincheck_supervision_id` = `t_vincheck_supervision`.`id` where `t_vincheck_supervision`.`is_exist` = 1 and `t_vincheck_supervision`.`type` = 1 and `t_vincheck_supervision_info`.`id` is null order by `t_vincheck_supervision`.`id` asc limit 500;
- 执行计划(EXPLAIN 表节点,按 JOIN 顺序):
| # | 表 | 访问类型 | 使用索引 | 候选索引 | 预扫行数 | 过滤后 |
|---|
| 1 | t_vincheck_supervision | ref | is_exist | is_exist,idx_type | 495,157 | 50.0% |
| 2 | t_vincheck_supervision_info | eq_ref | idx_vincheck_supervision_id | idx_vincheck_supervision_id | 1 | 10.0% |
- 慢因:扫描行数远大于返回行数(1,046,439/95)
- 建议:补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中
- 可执行 DDL(建议先在低峰期 EXPLAIN 验证再执行):
ALTER TABLE `t8891`.`t_vincheck_supervision` ADD INDEX `idx_is_exist_type` (`is_exist`, `type`);
- DDL 注:
t_vincheck_supervision 与现有索引 is_exist(is_exist) 前缀重复(is_exist), 新索引生效后可评估删除旧索引
8. select v_items.item_id, v_items.m_id, t_sele_item_update_plan.id as plan_id, t_sele_item_update_plan.type, t_sele_item_update_setting.id, t_sele_item_update_set —— 478 次 × 2.04s = 16.2min
select `v_items`.`item_id`, `v_items`.`m_id`, `t_sele_item_update_plan`.`id` as `plan_id`, `t_sele_item_update_plan`.`type`, `t_sele_item_update_setting`.`id`, `t_sele_item_update_setting`.`time` from `v_items` inner join `t_sele_item_update_plan` on `v_items`.`id` = `t_sele_item_update_plan`.`item_id` inner join `t_sele_item_update_setting` on `t_sele_item_update_plan`.`id` = `t_sele_item_update_setting`.`plan_id` left join `t_sele_item_hidden` on `v_items`.`id` = `t_sele_item_hidden`.`item_id` and `t_sele_item_hidden`.`status` > 0 where `v_items`.`item_display_status` = 1 and `t_sele_item_update_plan`.`status` = 1 and (`t_sele_item_update_setting`.`time` between '20:00:09' and '20:01:08') and `t_sele_item_hidden`.`id` is null;
- 库表:t8891.v_items;实例 alias:
prod-8891/master
- explain SQL:
select `v_items`.`item_id`, `v_items`.`m_id`, `t_sele_item_update_plan`.`id` as `plan_id`, `t_sele_item_update_plan`.`type`, `t_sele_item_update_setting`.`id`, `t_sele_item_update_setting`.`time` from `t8891`.`v_items` inner join `t8891`.`t_sele_item_update_plan` on `v_items`.`id` = `t_sele_item_update_plan`.`item_id` inner join `t8891`.`t_sele_item_update_setting` on `t_sele_item_update_plan`.`id` = `t_sele_item_update_setting`.`plan_id` left join `t8891`.`t_sele_item_hidden` on `v_items`.`id` = `t_sele_item_hidden`.`item_id` and `t_sele_item_hidden`.`status` > 0 where `v_items`.`item_display_status` = 1 and `t_sele_item_update_plan`.`status` = 1 and (`t_sele_item_update_setting`.`time` between '20:00:09' and '20:01:08') and `t_sele_item_hidden`.`id` is null;
- 执行计划(EXPLAIN 表节点,按 JOIN 顺序):
| # | 表 | 访问类型 | 使用索引 | 候选索引 | 预扫行数 | 过滤后 |
|---|
| 1 | t_sele_item_update_plan | ❌ 全表扫描 | — | PRIMARY,idx_item_id_status | 315,861 | 10.0% |
| 2 | t_sele_item_data | ref | item_id | item_id,idx_display_status_n_item_id | 1 | 5.0% |
| 3 | t_sele_item_infos | ref | item_id | item_id | 1 | 100.0% |
| 4 | t_sele_items | eq_ref | PRIMARY | PRIMARY | 1 | 100.0% |
| 5 | t_sele_item_hidden | ref | item_id | item_id | 1 | 10.0% |
| 6 | t_sele_item_update_setting | ref | idx_plan_id | idx_plan_id | 4 | 11.11% |
- 慢因:扫描行数远大于返回行数(6,347,315/430)、EXPLAIN 全表扫描/未用索引
- 建议:补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中
- 可执行 DDL(建议先在低峰期 EXPLAIN 验证再执行):
ALTER TABLE `t8891`.`v_items` ADD INDEX `idx_id_item_displ` (`id`, `item_display_status`);
ALTER TABLE `t8891`.`t_sele_item_update_plan` ADD INDEX `idx_status` (`status`);
ALTER TABLE `t8891`.`t_sele_item_hidden` ADD INDEX `idx_item_id_status` (`item_id`, `status`);
- DDL 注:
t_sele_item_hidden 与现有索引 item_id(item_id, recordtime) 前缀重复(item_id), 新索引生效后可评估删除旧索引
逐条优化建议汇总
P 行 = 深析模式(指纹聚合,按全天累计耗时降序 P1 最大,是优化主战场);T 行 = 单条耗时 Top3 的一次性慢 SQL(多为 bi/导出查询,治理手段通常是限流/降频/移到从库,而非建索引)。
| 编号 | 对象 | 建议 |
|---|
| P1 | t8891.t_member_devices(3,736×5.6s) | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; DDL: ALTER TABLE t8891.t_member_devices ADD INDEX idx_m_id_hash (m_id, hash); |
| P2 | t8891.t_carinfo_coupon_activity(23×282.9s) | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; DDL: ALTER TABLE t8891.t_carinfo_coupon_activity ADD INDEX idx_type_m_id (type, m_id); ALTER TABLE t8891.t_carinfo_coupon_activity_callback ADD INDEX idx_activity_i_payment_ti (activity_item_id, payment_time); ALTER TABLE t8891.t_carinfo_agent_call_to_bidding ADD INDEX idx_m_id_phase_type_created_at (m_id, phase, type, created_at); |
| P3 | t8891.t_carinfo_favorite(1,241×5.0s) | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; DDL: ALTER TABLE t8891.t_carinfo_favorite ADD INDEX idx_type_sale_stop_m_id_count (type, sale_stop, m_id, count);; 缩小聚合/去重范围(补时间等过滤条件), 或预聚合到中间表/定时任务; 把 ORDER BY 列纳入复合索引, 或减小排序前扫描范围 |
| P4 | t8891.t_carinfo_inquiry_agent(1,440×1.9s) | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; DDL: ALTER TABLE t8891.t_carinfo_inquiry_agent ADD INDEX idx_expire_sta_expire_tim (expire_status, expire_time); |
| P5 | t8891.t_carinfo_inquiry_agent(1,288×1.9s) | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; DDL: ALTER TABLE t8891.t_carinfo_inquiry_agent ADD INDEX idx_contact_st_expire_sta (contact_status, expire_status); |
| P6 | t8891.t_carinfo_inquiry_call_log(1,430×1.2s) | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; DDL: ALTER TABLE t8891.t_carinfo_inquiry_call_log ADD INDEX idx_record_tim (record_time); |
| P7 | t8891.t_vincheck_supervision(288×4.0s) | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; DDL: ALTER TABLE t8891.t_vincheck_supervision ADD INDEX idx_is_exist_type (is_exist, type); |
| P8 | t8891.v_items(478×2.0s) | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; DDL: ALTER TABLE t8891.v_items ADD INDEX idx_id_item_displ (id, item_display_status); ALTER TABLE t8891.t_sele_item_update_plan ADD INDEX idx_status (status); ALTER TABLE t8891.t_sele_item_hidden ADD INDEX idx_item_id_status (item_id, status); |
| T1 | Top1(同 P2 对象) 单条最慢 5.0min,user=t8891 t8891.t_carinfo_coupon_activity | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; bi/导出类: 限流降频、移从库/离线跑, 避免高峰占用主库 |
| T2 | Top2(同 P2 对象) 单条最慢 4.9min,user=t8891 t8891.t_carinfo_coupon_activity | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; bi/导出类: 限流降频、移从库/离线跑, 避免高峰占用主库 |
| T3 | Top3(同 P2 对象) 单条最慢 4.9min,user=t8891 t8891.t_carinfo_coupon_activity | 补索引(按 WHERE 等值列在前、范围列收尾建复合索引); 用 EXPLAIN 验证 key 命中; bi/导出类: 限流降频、移从库/离线跑, 避免高峰占用主库 |
*采集脚本 .agents/scripts/mysql_slow_prod_report.py,中间数据 outputs/slow_report_prod8891_20261104.json;全程只读。*