MCP HubMCP Hub
返回技能列表

Optimizing SQL Queries

jeremylongshore
更新于 Yesterday
68 次查看
1,053
135
1,053
在 GitHub 上查看
data

关于

This skill analyzes SQL queries to identify performance bottlenecks and suggest optimizations like index recommendations and query rewrites. Use it when developers mention slow queries or need help with SQL performance tuning. It helps improve database efficiency by reviewing query structure and execution plans.

快速安装

Claude Code

推荐
插件命令推荐
/plugin add https://github.com/jeremylongshore/claude-code-plugins-plus-skills
Git 克隆备选方式
git clone https://github.com/jeremylongshore/claude-code-plugins-plus-skills.git ~/.claude/skills/Optimizing SQL Queries

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Overview

This skill empowers Claude to analyze SQL queries, identify performance bottlenecks, and suggest optimizations such as index creation or query rewriting. It leverages the sql-query-optimizer plugin to provide actionable recommendations for improving database performance.

How It Works

  1. Query Input: The user provides an SQL query to be optimized.
  2. Analysis: The plugin analyzes the query structure, potential indexing issues, and execution plan (if available).
  3. Recommendations: The plugin generates optimization suggestions, including index recommendations and query rewrites.

When to Use This Skill

This skill activates when you need to:

  • Optimize a slow-running SQL query.
  • Identify missing or unused indexes in a database.
  • Improve the performance of a database application.

Examples

Example 1: Optimizing a Slow Query

User request: "Optimize this SQL query: SELECT * FROM orders WHERE customer_id = 123 AND order_date < '2023-01-01';"

The skill will:

  1. Analyze the provided SQL query.
  2. Suggest creating an index on customer_id and order_date columns to improve query performance.

Example 2: Finding Indexing Opportunities

User request: "I need help optimizing a query that filters on product_category and price. Can you suggest any indexes?"

The skill will:

  1. Analyze a hypothetical query based on the user's description.
  2. Recommend a composite index on (product_category, price) to speed up filtering.

Best Practices

  • Provide Full Queries: Include the complete SQL query for accurate analysis.
  • Include EXPLAIN Output: Providing the output of EXPLAIN can help the optimizer identify bottlenecks more effectively.
  • Test Recommendations: Always test the suggested optimizations in a staging environment before applying them to production.

Integration

This skill can be used in conjunction with other database management plugins to automate index creation and query rewriting based on the optimizer's suggestions.

GitHub 仓库

jeremylongshore/claude-code-plugins-plus-skills
路径: backups/plugin-enhancements/plugin-backups/sql-query-optimizer_20251020_055446/skills/skill-adapter
aiautomationclaude-codedevopsmarketplacemcp

相关推荐技能