sql-optimization-patterns

Identify and optimize inefficient SQL queries across PostgreSQL and MySQL.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/Lautaro073/zCorvus_agents --skill sql-optimization-patterns-lautaro073
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-optimization-patterns
Source: https://github.com/Lautaro073/zCorvus_agents/tree/main/AI_Workspace/Agents/Backend/skills/sql-optimization-patterns
Command: npx skills add https://github.com/Lautaro073/zCorvus_agents --skill sql-optimization-patterns-lautaro073

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires analyze-slow-queries.sql, index-recommendations.sql, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Transform slow database queries into lightning-fast operations through systematic optimization, proper indexing, and query plan analysis.

Core Features & Use Cases

  • Debugging slow-running queries
  • Designing performant database schemas
  • Optimizing application response times
  • Reducing database load and costs
  • Improving scalability for growing datasets
  • Analyzing EXPLAIN query plans
  • Implementing efficient indexes
  • Resolving N+1 query problems

Quick Start

Provide goals, constraints, and required inputs; then apply the recommended optimization patterns to accelerate queries.

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 and reduce database latency?

To optimize slow SQL queries, you analyze EXPLAIN query plans, implement efficient indexes, and apply safe query rewrites to reduce latency and database load. This systematic approach transforms slow database operations into fast operations.

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

Resolving N+1 query problems involves identifying inefficient query patterns through query plan analysis and rewriting them into structured, batched operations. This reduces redundant database calls and significantly lowers application response times.

How do I interpret EXPLAIN plans to debug PostgreSQL and MySQL performance issues?

Interpreting EXPLAIN plans requires examining execution steps to identify bottlenecks like full table scans or inefficient joins. Debugging performance issues this way guides proper index selection and safe query rewrites across PostgreSQL and MySQL.

Can I apply these SQL optimization patterns across both PostgreSQL and MySQL?

Yes, these SQL optimization patterns apply across PostgreSQL, MySQL, and other relational databases. They provide structured patterns and index guidance to improve scalability for growing datasets regardless of the specific relational database platform.

When should I use index recommendations to improve query performance?

You should use index recommendations when designing performant database schemas or debugging slow-running queries. Implementing efficient indexes reduces database load and costs while improving application response times for growing datasets.