sql-optimization-patterns

Identify slow SQL queries and optimize their execution plans with EXPLAIN ANALYZE.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/emilneuraz-ai/neuraz-web --skill sql-optimization-patterns-emilneuraz-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-optimization-patterns
Source: https://github.com/emilneuraz-ai/neuraz-web/tree/main/.agents/skills/.agents/skills/sql-optimization-patterns
Command: npx skills add https://github.com/emilneuraz-ai/neuraz-web --skill sql-optimization-patterns-emilneuraz-ai

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: Interpret query plans to identify bottlenecks.
  • Indexing Strategies: Design and implement effective indexes (B-tree, partial, expression, covering).
  • Pattern-based Optimizations: Apply common SQL optimization patterns to reduce latency and resource usage.
  • Use Case: Debug slow queries in production, optimize reports, and improve response times for data-heavy endpoints.

Quick Start

Run an EXPLAIN ANALYZE on a slow query and apply the recommended indexing strategy to improve performance.

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 using execution plans?

To optimize slow SQL queries, you run EXPLAIN ANALYZE to interpret the execution plan and identify resource bottlenecks, then apply pattern-based query rewriting and indexing strategies to reduce latency.

What are the best indexing strategies for large data workloads in PostgreSQL and MySQL?

For large data workloads in PostgreSQL and MySQL, the best indexing strategies involve designing B-tree, partial, expression, and covering indexes to directly target slow query execution plans and eliminate bottlenecks.

How does EXPLAIN ANALYZE help with SQL performance tuning?

EXPLAIN ANALYZE helps with SQL performance tuning by executing the query and returning the actual execution plan, allowing you to identify bottlenecks and apply validation with safe fallbacks during optimization.

Can I apply SQL optimization patterns to debug slow production queries?

Yes, you can apply SQL optimization patterns to debug slow production queries by using EXPLAIN workflows to analyze bottlenecks and implementing schema design decisions with safe fallbacks for tuning large data workloads.

When should I not use expression or partial indexes for query optimization?

You should avoid using expression or partial indexes for query optimization when the execution plan shows the overhead of maintaining the index outweighs the latency reduction, indicating a different query rewriting pattern is needed.