optimizing-sql

Analyze SQL execution plans and recommend indexing strategies for PostgreSQL, MySQL, and SQL Server.

503|73|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/ancoleman/ai-design-components --skill optimizing-sql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimizing-sql
Source: https://github.com/ancoleman/ai-design-components/tree/main/skills/optimizing-sql
Command: npx skills add https://github.com/ancoleman/ai-design-components --skill optimizing-sql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses slow database queries by providing tools and strategies to analyze execution plans, identify bottlenecks, and optimize SQL performance across PostgreSQL, MySQL, and SQL Server.

Core Features & Use Cases

  • EXPLAIN Plan Analysis: Interpret query execution plans to pinpoint performance issues.
  • Indexing Strategies: Guidance on creating single-column, composite, and covering indexes.
  • Query Rewriting: Techniques to refactor inefficient queries, avoid anti-patterns, and leverage database-specific features.
  • Use Case: A critical API endpoint is experiencing slow response times due to a poorly performing SQL query; this Skill helps diagnose the issue and provides actionable steps to rewrite the query and add appropriate indexes, reducing latency.

Quick Start

Use the optimizing-sql skill to analyze the performance of the provided SQL query and suggest optimizations.

Frequently Asked Questions about optimizing-sql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize slow SQL queries in PostgreSQL and MySQL?

Analyze SQL execution plans to pinpoint performance issues like sequential scans or missing indexes, then apply indexing strategies and query rewriting to resolve bottlenecks in PostgreSQL, MySQL, and SQL Server.

How do I read an EXPLAIN plan to fix database performance tuning issues?

Reading an EXPLAIN plan involves interpreting the execution plan to pinpoint performance issues such as sequential scans and missing indexes, which guides the creation of single-column, composite, or covering indexes to resolve slow query execution.

What is the best way to choose indexing strategies for slow query execution?

The best way to choose indexing strategies is by analyzing execution plans to identify bottlenecks, then selecting single-column, composite, or covering indexes based on the specific query patterns and database features in PostgreSQL, MySQL, or SQL Server.

Does this SQL performance tuning approach work for both PostgreSQL and SQL Server?

Yes, this SQL performance tuning approach works for PostgreSQL, MySQL, and SQL Server by analyzing execution plans and leveraging database-specific features to rewrite inefficient queries and recommend appropriate indexing strategies across all three platforms.

Why does my SQL query trigger a sequential scan instead of using an index?

A SQL query triggers a sequential scan when execution plans reveal missing indexes or inefficient query anti-patterns, which can be resolved by rewriting the query and implementing single-column, composite, or covering indexes.