sql-optimization

Analyzes SQL execution plans and recommends index designs and rewrites to optimize queries.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/badhope/skill --skill sql-optimization-badhope
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sql-optimization
Source: https://github.com/badhope/skill/tree/main/.trae/skills/domains/database/sql-optimization
Command: npx skills add https://github.com/badhope/skill --skill sql-optimization-badhope

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

SQL optimization expert to boost query performance by analyzing execution plans, designing effective indexes, and tuning queries for faster results.

Core Features & Use Cases

  • Query optimization: rewrite and tune SQL statements for efficiency.
  • Index design: create and select indexes that minimize I/O and accelerate access.
  • Execution plan analysis: interpret explain/analyze outputs to identify bottlenecks.
  • Performance tuning: holistic improvements across reads, writes, and caching.
  • Use Case: Optimize a slow report query by adding appropriate composites and covering indexes.

Quick Start

Paste a slow query and I will propose index changes and query rewrites to improve performance.

Frequently Asked Questions about sql-optimization

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

FAQPage Schema
How do I optimize slow SQL queries on large datasets?▼

SQL query optimization analyzes execution plans to identify bottlenecks and recommends index design or query rewrites to accelerate access on large datasets. You paste a slow query to receive proposed index changes and statement tuning for faster results.

What's the best way to analyze an execution plan to find database performance bottlenecks?▼

Execution plan analysis interprets explain or analyze outputs to pinpoint database performance bottlenecks like full table scans. By parsing these plans, you can identify inefficient access paths and apply query rewrites or composite indexes to minimize I/O.

How do I design indexes to improve database query performance?▼

Index design improves database query performance by creating composite and covering indexes that minimize I/O and accelerate data access. Effective index selection targets slow report queries and reduces the need for full table scans.

Can I use this SQL query tuning approach across different relational databases?▼

Yes, this SQL query tuning approach applies to performance tuning tasks across relational databases. Execution plan analysis and index design recommendations are valid for optimizing slow queries and large datasets regardless of the specific database platform.

Why does my SQL report query timing out when fetching large amounts of data?▼

SQL report queries time out when fetching large datasets due to missing composite or covering indexes, causing high I/O and full table scans. Analyzing the execution plan reveals these bottlenecks so you can apply query tuning and index design.

What are the limitations of query rewriting for database performance tuning?▼

Query rewriting for database performance tuning is limited when underlying schema design lacks appropriate indexing or when bottlenecks stem from hardware constraints. Optimization requires holistic improvements across reads, writes, and caching beyond statement rewrites.