AGENT SKILL

MySQL 慢查询诊断

mysql-slow-query-diagnosis

针对受监控的 MySQL 或 MariaDB 实例,诊断慢查询、活动会话、锁和查询计划。当正在排查数据库延迟或查询性能问题时使用。

适用职业数据库管理员
使用场景数据库管理
License 许可
Apache-2.0
所属仓库
apache/hertzbeat
最近更新
2026-11-14
Stars
★ 7.5k
Forks
1.4k

01 前言 Front Matter

name
mysql-slow-query-diagnosis
description
Diagnose slow queries, active sessions, locks, and query plans for a monitored MySQL or MariaDB instance. Use when database latency or query performance is under investigation.

03 SKILL.md 正文

<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0. -->

MySQL Slow Query Diagnosis

  1. Resolve the exact monitor and confirm it is a MySQL or MariaDB monitor.
  2. Use database.mysql_slow_queries to identify expensive query patterns.
  3. Use database.mysql_process_list to inspect currently active work.
  4. Use database.mysql_lock_waits when concurrency or blocking may be involved.
  5. Use database.mysql_global_status with a focused pattern for relevant server counters.
  6. Use database.explain_query only when the user supplied a concrete SELECT statement that needs plan analysis.
  7. Correlate the observations before recommending indexes, SQL changes, or server tuning.
  8. Separate evidence, inference, and recommendations in the final Markdown report.

Never request database credentials. Use only credentials already configured on the HertzBeat monitor.

04 同仓库更多 Skills