SQL Query Optimizer

Verified

by Community

Analyzes SQL queries and suggests optimizations including index usage, query rewriting, join optimization, subquery elimination, and proper use of database-specific features. Supports PostgreSQL, MySQL, and SQL Server dialects.

sqloptimizationperformancequeriesdatabase

SQL Query Optimizer

Optimize slow SQL queries by analyzing execution plans and suggesting index, join, and rewrite improvements.

Usage

Paste your slow SQL query and optionally the EXPLAIN output, and this skill will suggest optimizations.

Examples

  • "Optimize this query that takes 30 seconds to return results"
  • "Suggest indexes for my frequently-used WHERE and JOIN clauses"
  • "Rewrite this correlated subquery as a more efficient JOIN"

Guidelines

  • Always analyze the execution plan before suggesting changes
  • Consider the table sizes and data distribution
  • Avoid premature optimization for small datasets
  • Test optimized queries against realistic data volumes
  • Monitor query performance after applying changes