optimizing-sql

Analyze SQL execution plans and apply indexing strategies across PostgreSQL, MySQL, and SQL Server.

1|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/masermediagroup-stack/CursorSkills --skill optimizing-sql-masermediagroup-stack
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimizing-sql
Source: https://github.com/masermediagroup-stack/CursorSkills/tree/main/skills-bundle/skills/community/ai-design-components/skills/optimizing-sql
Command: npx skills add https://github.com/masermediagroup-stack/CursorSkills --skill optimizing-sql-masermediagroup-stack

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Improve SQL query performance by analyzing execution plans and applying indexing strategies.

Core Features & Use Cases

  • Analyze slow queries with EXPLAIN ANALYZE to identify bottlenecks such as table scans, nested loops, and high-cost operations.
  • Design and apply indexing strategies (single-column and composite indexes) and query rewrites to reduce execution time across PostgreSQL, MySQL, and SQL Server.
  • Real-world use cases include optimizing common report queries, transactional lookups, and joins in multi-table schemas.

Quick Start

Provide a representative slow SQL query and I will generate an optimized plan, recommended indexes, and a rewritten version to improve performance.

Frequently Asked Questions about optimizing-sql

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

FAQPage Schema
How do I analyze a slow SQL query using an execution plan?

To analyze slow SQL query performance, you run EXPLAIN ANALYZE to identify bottlenecks like table scans, nested loops, and high-cost operations. This reveals how the database executes the query, allowing you to target specific areas for optimization.

What's the best way to optimize PostgreSQL queries with composite indexes?

The best way to optimize PostgreSQL queries is by designing and applying composite indexes alongside query rewrites. This reduces execution time by ensuring the database can efficiently locate and join data across multi-table schemas.

Does this SQL query optimization approach work with MySQL and SQL Server?

Yes, this query optimization approach works with MySQL and SQL Server. It applies database-specific optimizations across PostgreSQL, MySQL, and SQL Server to improve performance for transactional lookups and report queries.

When do I need to rewrite SQL queries instead of just adding indexes?

You need to rewrite SQL queries when adding single-column indexes is insufficient to reduce execution time. Query rewrites complement indexing strategies by restructuring how data is retrieved, especially for complex joins in multi-table schemas.

Can I optimize common report queries and transactional lookups in multi-table schemas?

Yes, you can optimize common report queries and transactional lookups in multi-table schemas. By analyzing execution plans and applying targeted indexing strategies, you can significantly reduce execution time for these real-world use cases.