sql-optimization-patterns

Analyze EXPLAIN plans and implement indexing strategies for SQL queries.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/MuhamadAnang/wareflow-project --skill sql-optimization-patterns-muhamadanang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-optimization-patterns
Source: https://github.com/MuhamadAnang/wareflow-project/tree/main/.agents/skills/sql-optimization-patterns
Command: npx skills add https://github.com/MuhamadAnang/wareflow-project --skill sql-optimization-patterns-muhamadanang

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps you diagnose and fix slow database queries, leading to significantly faster application performance and reduced database load.

Core Features & Use Cases

  • Query Analysis: Understand EXPLAIN plans to pinpoint bottlenecks.
  • Indexing Strategies: Learn to create effective indexes for various data types and query patterns.
  • Optimization Patterns: Apply proven techniques like eliminating N+1 queries and optimizing pagination.
  • Use Case: If your application's user dashboard is loading slowly due to complex database queries, this Skill can guide you through analyzing the queries and implementing the right indexes or query rewrites to speed it up.

Quick Start

Use the sql-optimization-patterns skill to analyze the EXPLAIN plan for the query 'SELECT * FROM orders WHERE created_at > NOW() - INTERVAL '30 days';'.

Frequently Asked Questions about sql-optimization-patterns

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?

Improve SQL query performance by analyzing EXPLAIN execution plans to pinpoint bottlenecks, implementing effective indexing strategies, and applying advanced optimization patterns to reduce query execution times and slash database load.

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

Eliminating N+1 query problems requires applying advanced optimization patterns to consolidate data retrieval, preventing inefficient repeated database requests and significantly reducing overall database load during complex data access operations.

How do I read an EXPLAIN plan to find database bottlenecks?

Reading an EXPLAIN plan involves analyzing the query execution steps to pinpoint performance bottlenecks, identifying inefficient data retrieval paths, and determining necessary indexing strategies for relational databases like PostgreSQL and MySQL.

Do I need to understand database internals to optimize query performance?

Yes, optimizing query performance requires a solid understanding of database internals, query execution mechanisms, and indexing techniques to effectively diagnose slow execution and apply the correct optimization patterns.

Can I use indexing strategies to fix a slow loading user dashboard?

Yes, you can fix a slow loading user dashboard by analyzing the complex database queries powering it, implementing effective indexing strategies, and rewriting inefficient queries to speed up data retrieval.

What are the limitations of query tuning for high database load?

Query tuning limitations arise when underlying schema designs are inherently inefficient; while indexing strategies and optimization patterns reduce slow query execution, they cannot fix structural data retrieval bottlenecks alone.