sql-query-optimization

Diagnose and optimize slow SQL queries in PostgreSQL and MySQL.

2|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/bingeli1379/eli-claude-marketplace --skill sql-query-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-query-optimization
Source: https://github.com/bingeli1379/eli-claude-marketplace/tree/main/plugins/eureka-sdd/skills/sql-query-optimization
Command: npx skills add https://github.com/bingeli1379/eli-claude-marketplace --skill sql-query-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

SQL query optimization tackles slow database performance by diagnosing and tuning queries across PostgreSQL and MySQL for faster results.

Core Features & Use Cases

  • Analyze slow queries with EXPLAIN ANALYZE to identify bottlenecks.
  • Apply indexing strategies (composite, covering, partial) and query rewrites to reduce runtime.
  • Real-world use: optimize a reporting query that scans large orders tables to return top customers in under a second.

Quick Start

Analyze a slow query with EXPLAIN ANALYZE and propose indexing and rewriting steps to improve performance.

Frequently Asked Questions about sql-query-optimization

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

FAQPage Schema
How do I fix slow PostgreSQL and MySQL queries using EXPLAIN ANALYZE?

To fix slow PostgreSQL and MySQL queries, use EXPLAIN ANALYZE to identify bottlenecks like sequential scans or temp table spills. This allows you to apply targeted indexing and query rewriting to significantly reduce query runtime.

What is the best way to resolve N+1 queries and missing indexes in SQL?

The best way to resolve N+1 queries and missing indexes in SQL is to apply composite, covering, or partial indexing strategies. Combined with query rewriting, these indexing strategies eliminate redundant data fetching and accelerate overall performance.

How do I optimize OFFSET pagination for large tables in MySQL?

To optimize OFFSET pagination for large tables in MySQL, you must rewrite the pagination logic to avoid scanning large offset rows. Applying proper indexing strategies and query rewrites prevents sequential scans and reduces runtime for deep pagination requests.

Does this query tuning approach work for both PostgreSQL and MySQL?

Yes, this query tuning approach works for both PostgreSQL and MySQL. It provides production-grade guidance on index strategies, configuration considerations, and repeatable optimization workflows to remediate slow queries across both database platforms.

When do I need to use covering indexes for SQL query optimization?

You need to use covering indexes for SQL query optimization when a query can be satisfied entirely by the index without accessing the underlying table data. This technique reduces runtime and prevents sequential scans on large tables.

Why does my reporting query scan large tables instead of using indexes?

Your reporting query scans large tables instead of using indexes due to missing indexes or inefficient query structure. Analyzing the execution plan with EXPLAIN ANALYZE helps identify these bottlenecks so you can apply proper indexing and query rewriting.