W

sql-optimization-patterns

by wshobson

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

Stars0
Favorites0
Comments0
AddedMar 28, 2026
CategoryDatabase Engineering
Install Command
npx skills add https://github.com/wshobson/agents --skill sql-optimization-patterns
Overview

Overview

What is sql-optimization-patterns?

sql-optimization-patterns is a practical skill for developers and database engineers who need to optimize SQL queries, design efficient database schemas, and analyze query execution plans. This skill provides actionable patterns for improving database performance, reducing slow queries, and implementing effective indexing strategies.

Who Should Use This Skill?

  • Backend developers working with SQL databases (Postgres, MySQL, etc.)
  • Database administrators seeking to improve query speed and scalability
  • Application engineers troubleshooting slow database responses
  • Teams aiming to reduce infrastructure costs by optimizing queries

Problems Solved

  • Identifies and resolves slow-running queries
  • Guides you through EXPLAIN plan analysis
  • Helps design and implement efficient indexes
  • Addresses common performance pitfalls like N+1 queries
  • Improves scalability for growing datasets

How to Use

Installation Steps

  1. Install the skill using the following command:

    npx skills add https://github.com/wshobson/agents --skill sql-optimization-patterns

  2. Begin with the SKILL.md file for a structured overview of optimization patterns and practical examples.

  3. Review supporting files such as README.md, AGENTS.md, and any rules/, resources/, or references/ folders for deeper context and advanced use cases.

Core Workflow

  • Use EXPLAIN and EXPLAIN ANALYZE to inspect query execution plans in your database.
  • Identify slow operations (e.g., Seq Scan, Nested Loop) and apply recommended indexing or query rewrite strategies.
  • Implement and test index changes to ensure improved performance.
  • Adapt the provided patterns to your specific database and application environment.

When to Use sql-optimization-patterns

  • When debugging slow queries in production or development
  • During schema design or refactoring
  • While optimizing application endpoints that rely on database queries
  • To proactively improve scalability before data volume increases

FAQ

What databases does sql-optimization-patterns support?

This skill is most relevant for SQL databases such as PostgreSQL and MySQL, focusing on query plan analysis and indexing strategies.

Where do I start after installation?

Start with the SKILL.md file for a high-level overview and practical examples. Explore the file tree for additional resources and scripts.

Is this skill suitable for beginners?

Yes. The patterns and examples are practical and accessible for developers new to SQL optimization, while still offering value to experienced engineers.

Can I use sql-optimization-patterns for ongoing performance monitoring?

While the skill focuses on optimization patterns and query analysis, it can be integrated into regular code reviews and database audits to maintain performance.

Where can I find more examples or advanced usage?

Check the repository's supporting files and references for deeper dives into specific optimization scenarios and advanced query tuning techniques.

Ratings & Reviews

No ratings yet
Share your review
Sign in to leave a rating and comment for this skill.
G
0/10000
Latest reviews
Saving...