sql-optimization-patterns

Analyze SQL execution plans and apply indexing strategies for query performance.

1|Updated Apr 27, 2026
One-click install
npx skills add https://github.com/haxlys/skills --skill sql-optimization-patterns-haxlys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-optimization-patterns
Source: https://github.com/haxlys/skills/tree/main/vendored/wshobson-agents/plugins/developer-essentials/skills/sql-optimization-patterns
Command: npx skills add https://github.com/haxlys/skills --skill sql-optimization-patterns-haxlys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries.

Core Features & Use Cases

  • EXPLAIN analysis and query plan interpretation to identify bottlenecks
  • Indexing strategies (B-Tree, partial, functional, covering) to speed up lookups
  • Pattern-driven refactoring and best practices for common schemas and workloads
  • Use case: debugging slow queries and designing performant schemas for scalable apps

Quick Start

Run an EXPLAIN ANALYZE on a slow query and implement the recommended indexing changes to observe performance gains.

Frequently Asked Questions about sql-optimization-patterns

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

FAQPage Schema
How do I analyze slow SQL query performance using EXPLAIN?

To analyze slow SQL query performance, you run an EXPLAIN ANALYZE on the query to interpret the execution plan and identify bottlenecks. This skill evaluates query plans to pinpoint performance issues and recommend specific indexing or refactoring changes for relational databases.

What is the best way to speed up database lookups with indexing strategies?

Indexing strategies speed up database lookups by applying B-Tree, partial, functional, or covering indexes to specific schema workloads. This skill provides pattern-driven indexing recommendations with validation and guardrails to ensure optimal query performance without degrading existing database operations.

Can I use this SQL optimization approach with PostgreSQL and MySQL?

Yes, this SQL optimization approach works with PostgreSQL, MySQL, and other relational databases. It applies proven optimization patterns to debug performance issues and design performant schemas across various relational database platforms.

When do I need to refactor SQL queries for better performance?

You need to refactor SQL queries when EXPLAIN analysis reveals execution plan bottlenecks that indexing alone cannot solve. This skill applies pattern-driven refactoring and best practices to address common schema and workload issues for scalable database-backed applications.

Does this approach support partial and functional indexes for optimization?

Yes, this optimization approach explicitly supports partial and functional indexes alongside B-Tree and covering indexes. It provides targeted indexing recommendations based on your specific query execution plans to deliver measurable performance gains.