sql-optimization-patterns

Analyze EXPLAIN output and implement indexing strategies to optimize SQL query performance.

89|14|Updated Nov 15, 2025
One-click install
npx skills add https://github.com/HermeticOrmus/LibreUIUX-Claude-Code --skill sql-optimization-patterns-hermeticormus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-optimization-patterns
Source: https://github.com/HermeticOrmus/LibreUIUX-Claude-Code/tree/main/plugins/developer-essentials/skills/sql-optimization-patterns
Command: npx skills add https://github.com/HermeticOrmus/LibreUIUX-Claude-Code --skill sql-optimization-patterns-hermeticormus

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill addresses the critical issue of slow database performance by providing systematic strategies for SQL query optimization, effective indexing, and in-depth analysis of query execution plans.

Core Features & Use Cases

  • Query Plan Analysis: Understand EXPLAIN output to identify bottlenecks.
  • Indexing Strategies: Learn to create and use various index types (B-Tree, GIN, etc.) for maximum efficiency.
  • Optimization Patterns: Implement proven techniques like eliminating N+1 queries, optimizing pagination, and efficient aggregation.
  • Use Case: When a critical application feature experiences slow load times due to database queries, this Skill provides the knowledge to diagnose the issue using EXPLAIN ANALYZE and implement targeted index or query modifications to resolve it.

Quick Start

Use the sql-optimization-patterns skill to analyze the EXPLAIN output for a slow query.

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 EXPLAIN output to fix slow SQL queries?

Analyze EXPLAIN output to identify execution bottlenecks like sequential scans or nested loops. This Skill helps diagnose slow SQL queries by interpreting query plans and implementing targeted indexing or query modifications to resolve performance issues.

What is the best way to eliminate N+1 query problems in relational databases?

Eliminate N+1 query problems by applying optimization patterns like eager loading or batch fetching. This Skill provides strategies to refactor inefficient data access logic in relational databases, significantly reducing redundant query execution overhead.

How do I optimize database pagination for large datasets?

Optimize database pagination by replacing OFFSET clauses with keyset pagination patterns. This Skill implements efficient pagination techniques in SQL queries to prevent performance degradation when navigating deep into large relational datasets.

When do I need B-Tree or GIN indexing strategies for query tuning?

Need B-Tree or GIN indexing strategies when query tuning reveals missing indexes or slow filtering operations. This Skill guides creating various index types to maximize efficiency based on specific SQL execution mechanics and data types.

Do I need to understand SQL execution mechanics to use query tuning patterns?

Yes, understanding SQL execution mechanics and database indexing principles is required. This Skill requires prerequisite knowledge of how relational databases process queries internally to effectively apply advanced optimization patterns.

Why does my database experience slow load times despite having indexes?

Slow load times despite indexes occur due to inefficient query structures or suboptimal execution plans. Use this Skill to run EXPLAIN ANALYZE, identify bottlenecks, and implement correct index usage or query modifications for better performance.