SQL Query Optimization Analyzer

Analyze and optimize slow SQL queries for better performance

6/11/2026
Prompt
Analyze this SQL query and provide optimization recommendations:

**Query:**
```sql
{{SQL_QUERY}}
```

**Table Schema:**
```sql
{{TABLE_SCHEMA}}
```

**Current Execution Time:** {{CURRENT_EXECUTION_TIME}}
**Database System:** {{DATABASE_SYSTEM}}

Please provide:
1. Query analysis identifying performance bottlenecks
2. Optimized version of the query
3. Recommended indexes to create
4. Explanation of why each optimization improves performance
5. Estimated performance improvement
6. Alternative query approaches if applicable

Or press ⌘C to copy

Variables (4)

Replace these placeholders with your own content before using the prompt.

[{SQL_QUERY][{TABLE_SCHEMA][{CURRENT_EXECUTION_TIME][{DATABASE_SYSTEM]

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...