Optimizing SQL Queries
关于
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-skillsgit 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
- 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 仓库
相关推荐技能
content-collections
元Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
hybrid-cloud-networking
元这个Skill帮助开发者配置本地基础设施与云平台之间的安全高性能连接。它支持VPN和专用连接选项,适用于构建混合云架构、连接数据中心到云以及实现安全的跨地域网络。关键能力包括建立AWS、Azure、GCP的混合连接,满足合规要求并支持渐进式云迁移。
llamaindex
元LlamaIndex是一个专门构建RAG应用的开发框架,提供300多种数据连接器用于文档摄取、索引和查询。它具备向量索引、查询引擎和智能代理等核心功能,支持构建文档问答、知识检索和聊天机器人等数据密集型应用。开发者可用它快速搭建连接私有数据与LLM的RAG管道。
csv-data-summarizer
元该Skill能自动分析CSV文件,无需用户交互即可生成统计摘要和可视化图表。它专为处理表格数据请求而设计,内置pandas、matplotlib和seaborn依赖。开发者在上传CSV或提出数据分析需求时,系统会直接执行全量分析并输出结果。
