sql-optimization

Analyze execution plans and optimize SQL queries for MySQL and PostgreSQL.

1|Updated Jan 31, 2026
One-click install
npx skills add https://github.com/ryukyagamilight/terminal-skills --skill sql-optimization-ryukyagamilight
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-optimization
Source: https://github.com/ryukyagamilight/terminal-skills/tree/main/database/sql-optimization
Command: npx skills add https://github.com/ryukyagamilight/terminal-skills --skill sql-optimization-ryukyagamilight

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses slow database queries and performance bottlenecks by providing tools and techniques for SQL optimization and tuning.

Core Features & Use Cases

  • Execution Plan Analysis: Understand how your SQL queries are executed using EXPLAIN and EXPLAIN ANALYZE.
  • Index Optimization: Design, implement, and verify effective database indexes to speed up data retrieval.
  • Query Tuning: Refactor SQL statements for better performance, including JOINs, subqueries, and pagination.
  • Slow Query Identification: Analyze and diagnose slow-running queries using database-specific tools.
  • Use Case: A web application is experiencing slow load times due to inefficient database queries. This Skill can be used to analyze the execution plans of critical queries, identify missing or poorly designed indexes, and suggest optimized SQL statements.

Quick Start

Use the sql-optimization skill to analyze the execution plan for the query 'SELECT * FROM users WHERE email = '[email protected]';'.

Frequently Asked Questions about sql-optimization

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

FAQPage Schema
How do I analyze a slow SQL query execution plan?

Analyze slow SQL query execution plans using `EXPLAIN` and `EXPLAIN ANALYZE` to understand query execution paths. This reveals how the database processes SELECT, JOIN, and subquery statements to identify performance bottlenecks.

What is the best way to optimize database indexes for query tuning?

Optimize database indexes by designing, implementing, and verifying effective indexes to speed up data retrieval. Proper index optimization directly addresses slow data fetching and reduces overall query execution time.

How do I identify slow queries in MySQL and PostgreSQL?

Identify slow queries in MySQL and PostgreSQL by analyzing and diagnosing slow-running statements using database-specific tools. This process pinpoints inefficient SQL operations that cause application performance bottlenecks.

How can I rewrite SQL statements to improve large table pagination?

Rewrite SQL statements to improve large table pagination by refactoring SELECT, JOIN, and subquery structures. Optimized query rewriting enhances data retrieval efficiency and resolves slow load times in web applications.

Does this SQL optimization guidance cover batch updates and lock optimization?

Yes, this SQL optimization guidance covers batch updates and lock optimization. It provides comprehensive tuning techniques for common scenarios like large table pagination, batch updates, and lock optimization to improve database performance.