数据库查询分析器Skill db-query-analyzer

数据库查询分析器是一款专业的数据库性能优化工具,专注于SQL查询性能分析、执行计划解析、索引优化建议和慢查询诊断。通过深度分析PostgreSQL、MySQL、SQL Server等主流数据库的查询执行路径,提供精准的性能瓶颈定位和优化方案,帮助开发者提升数据库查询效率,降低系统负载。关键词:数据库优化、SQL性能分析、执行计划、索引推荐、慢查询诊断、查询调优、数据库性能监控、PostgreSQL优化、MySQL调优。

后端开发 0 次安装 0 次浏览 更新于 2/26/2026

名称:数据库查询分析器 描述:通过执行计划和索引推荐分析数据库查询性能 允许使用的工具:

  • Bash
  • Read
  • Write
  • Glob

数据库查询分析器技能

概述

分析数据库查询性能,包括执行计划分析、索引推荐、慢查询识别和优化建议。

能力

  • 查询执行计划分析
  • 索引推荐
  • 慢查询识别
  • 查询优化建议
  • 表扫描检测
  • 连接优化分析
  • 支持 PostgreSQL、MySQL、SQL Server

目标流程

  • 性能优化
  • 数据架构设计

输入模式

{
  "type": "object",
  "required": ["queries"],
  "properties": {
    "queries": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "sql": { "type": "string" },
          "name": { "type": "string" }
        }
      }
    },
    "database": {
      "type": "string",
      "enum": ["postgresql", "mysql", "sqlserver", "oracle"],
      "default": "postgresql"
    },
    "connectionString": {
      "type": "string",
      "description": "数据库连接字符串(可选,用于实时分析)"
    },
    "options": {
      "type": "object",
      "properties": {
        "analyzeExplain": {
          "type": "boolean",
          "default": true
        },
        "suggestIndexes": {
          "type": "boolean",
          "default": true
        },
        "slowQueryThreshold": {
          "type": "number",
          "default": 1000,
          "description": "慢查询阈值(单位:毫秒)"
        }
      }
    }
  }
}

输出模式

{
  "type": "object",
  "properties": {
    "analyses": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "query": { "type": "string" },
          "executionPlan": { "type": "object" },
          "estimatedCost": { "type": "number" },
          "issues": { "type": "array" },
          "suggestions": { "type": "array" }
        }
      }
    },
    "indexRecommendations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "table": { "type": "string" },
          "columns": { "type": "array" },
          "type": { "type": "string" },
          "reason": { "type": "string" }
        }
      }
    },
    "slowQueries": {
      "type": "array"
    }
  }
}

使用示例

{
  kind: 'skill',
  skill: {
    name: 'db-query-analyzer',
    context: {
      queries: [
        { sql: 'SELECT * FROM users WHERE email = ?', name: 'get-user-by-email' }
      ],
      database: 'postgresql',
      options: {
        analyzeExplain: true,
        suggestIndexes: true
      }
    }
  }
}