optimizing-sql-queries
About
This skill analyzes SQL queries to identify performance bottlenecks and suggest optimizations like index creation and query rewrites. Use it when developers mention slow queries or need help with SQL performance and indexing. It provides actionable recommendations by examining query structure and execution plans.
Quick Install
Claude Code
Recommended/plugin add https://github.com/jeremylongshore/claude-code-plugins-plusgit clone https://github.com/jeremylongshore/claude-code-plugins-plus.git ~/.claude/skills/optimizing-sql-queriesCopy and paste this command in Claude Code to install this skill
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.
GitHub Repository
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.
content-collections
MetaThis skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.
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.
