query-optimization

Analyze SQL execution plans with EXPLAIN and benchmark optimizations.

105|8|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/686f6c61/alfred-dev --skill query-optimization-686f6c61
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-optimization
Source: https://github.com/686f6c61/alfred-dev/tree/main/skills/datos/query-optimization
Command: npx skills add https://github.com/686f6c61/alfred-dev --skill query-optimization-686f6c61

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you identify and resolve slow-running SQL queries, improving database performance and application responsiveness.

Core Features & Use Cases

  • Analyze Query Performance: Uses EXPLAIN and EXPLAIN ANALYZE to understand query execution plans.
  • Identify Bottlenecks: Detects issues like full table scans, inefficient joins, and missing indexes.
  • Propose Solutions: Suggests creating indexes, rewriting queries, or using specific database features.
  • Benchmark Improvements: Validates optimizations by comparing performance before and after changes.
  • Use Case: When a user reports that a specific database query is taking too long to complete, this skill can be invoked to diagnose and fix the performance issue.

Quick Start

Use the query-optimization skill to analyze and improve the performance of the following SQL query: SELECT * FROM users WHERE signup_date > '2023-01-01'.

Frequently Asked Questions about query-optimization

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

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

To optimize slow SQL queries, analyze execution plans using EXPLAIN and EXPLAIN ANALYZE to detect bottlenecks like full table scans or inefficient joins, then resolve them by creating missing indexes or rewriting queries.

What causes full table scans in database queries and how do I fix them?

Full table scans in database queries often indicate missing indexes or inefficient joins. Identify them using EXPLAIN ANALYZE, then fix the performance issue by creating targeted indexes or rewriting the query to leverage existing database features.

How do I benchmark SQL query performance before and after index tuning?

Benchmark SQL query performance by comparing execution times before and after index tuning or query rewriting. Validate optimizations by running the query, applying changes like index creation, and measuring the resulting performance improvement.

When should I use EXPLAIN ANALYZE instead of EXPLAIN for query tuning?

Use EXPLAIN ANALYZE for query tuning when you need actual execution statistics to identify runtime bottlenecks like full table scans, whereas EXPLAIN only shows the planned execution path without executing the query.

Can I rewrite inefficient joins to improve database performance without creating indexes?

Yes, you can rewrite inefficient joins to improve database performance by restructuring the query logic, although combining query rewriting with index creation often yields the most significant performance optimization.

Does query optimization work for resolving bottlenecks in any SQL database?

Query optimization techniques using EXPLAIN and EXPLAIN ANALYZE apply broadly to SQL databases that support these commands, helping identify bottlenecks and propose solutions like index creation and query rewriting.