Optimizing SQL Queries
About
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.
Documentation
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
- Query Input: The user provides an SQL query to be optimized.
- Analysis: The plugin analyzes the query structure, potential indexing issues, and execution plan (if available).
- 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:
- Analyze the provided SQL query.
- 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:
- Analyze a hypothetical query based on the user's description.
- 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
EXPLAINcan 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.
Quick Install
/plugin add https://github.com/jeremylongshore/claude-code-plugins-plus-skills/tree/main/skill-adapterCopy and paste this command in Claude Code to install this skill
GitHub 仓库
Related Skills
csv-data-summarizer
MetaThis skill automatically analyzes CSV files to generate comprehensive statistical summaries and visualizations using Python's pandas and matplotlib/seaborn. It should be triggered whenever a user uploads or references CSV data without prompting for analysis preferences. The tool provides immediate insights into data structure, quality, and patterns through automated analysis and visualization.
llamaindex
MetaLlamaIndex is a data framework for building RAG-powered LLM applications, specializing in document ingestion, indexing, and querying. It provides key features like vector indices, query engines, and agents, and supports over 300 data connectors. Use it for document Q&A, chatbots, and knowledge retrieval when building data-centric applications.
hybrid-cloud-networking
MetaThis skill configures secure hybrid cloud networking between on-premises infrastructure and cloud platforms like AWS, Azure, and GCP. Use it when connecting data centers to the cloud, building hybrid architectures, or implementing secure cross-premises connectivity. It supports key capabilities such as VPNs and dedicated connections like AWS Direct Connect for high-performance, reliable setups.
Excel Analysis
MetaThis skill enables developers to analyze Excel files and perform data operations using pandas. It can read spreadsheets, create pivot tables, generate charts, and conduct data analysis on .xlsx files and tabular data. Use it when working with Excel files, spreadsheets, or any structured tabular data within Claude Code.
