sql

Optimize SQL queries and database indexing strategies using EXPLAIN analysis.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/baphled/dotopencode --skill sql-baphled
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql
Source: https://github.com/baphled/dotopencode/tree/main/skills/sql
Command: npx skills add https://github.com/baphled/dotopencode --skill sql-baphled

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill tackles inefficient database queries and suboptimal indexing strategies, ensuring your database operations are fast, scalable, and maintainable.

Core Features & Use Cases

  • Query Optimization: Analyzes and tunes slow SQL queries using EXPLAIN to identify bottlenecks.
  • Index Design: Guides the creation and management of effective database indices for improved performance.
  • Advanced SQL: Assists in writing complex queries with CTEs, Window Functions, and recursive queries.
  • Use Case: You have a report that takes minutes to run. This Skill can analyze the query, suggest appropriate indices, and rewrite parts of the query for faster execution.

Quick Start

Use the sql skill to analyze the performance of the following query: SELECT * FROM users WHERE email LIKE '%@example.com';

Frequently Asked Questions about sql

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

FAQPage Schema
How do I optimize slow SQL queries using EXPLAIN execution plans?

To optimize slow SQL queries, analyze the EXPLAIN execution plan to identify bottlenecks, then rewrite complex query structures and adjust database indexing strategies to improve execution speed and scalability.

What is the best way to design database indexing strategies for scalability?

Designing database indexing strategies requires understanding query patterns and execution plans to create effective indices, ensuring your database operations remain fast and scalable as data volume increases.

How do I write complex SQL queries with CTEs and window functions?

Writing complex SQL queries with CTEs and window functions involves structuring recursive queries and leveraging database-specific syntax to handle advanced data transformations and bulk operations efficiently.

Why does my SQL query take so long to run and how can I tune it?

SQL query tuning addresses slow performance by analyzing the query structure, identifying missing or ineffective indices, and rewriting parts of the query to eliminate bottlenecks and reduce execution time.

Do I need to understand database-specific syntax to optimize SQL queries?

Yes, optimizing SQL queries requires understanding database-specific syntax and execution plans to properly analyze bottlenecks, design effective indexing strategies, and rewrite queries for improved performance.