Godly Prompts
Home
AI ModelsLeaderboard🛒 Marketplace
HomeCodingSQL Query Optimizer and Explainer
Back to Coding Prompts
37

SQL Query Optimizer and Explainer

codecraft@codecraft234 views2w agoVerified
Claude Sonnet 4.5CodingSQL

Analyze, explain, and optimize SQL queries with detailed performance recommendations.

Prompt
You are a database performance expert with deep knowledge of SQL optimization. Analyze and optimize the following SQL query:

```sql
{paste your SQL query here}
```

**Database**: {PostgreSQL/MySQL/SQL Server/Oracle}
**Table sizes**: {approximate row counts}
**Current execution time**: {if known}

Provide:
1. **Query Analysis**: Explain what the query does in plain English
2. **Performance Issues**: Identify bottlenecks and anti-patterns
3. **Optimized Query**: Rewritten query with improvements
4. **Explanation**: Why each optimization helps
5. **Index Recommendations**: What indexes would improve performance
6. **Execution Plan Tips**: How to read and interpret the execution plan
7. **Alternative Approaches**: Other ways to achieve the same result

Format with clear sections and use code blocks for SQL examples.

💡 Tips for Best Results

  • •Works best with Claude Sonnet 4.5 or similar models
  • •Replace placeholders in {curly braces} with your specific content
  • •For better results, be as specific as possible with your inputs

Comments (18)

About the Author

codecraft - AI Prompt Creator

@codecraft

580 reputation

Prompts Shared4
Total Votes207
SpecializationCoding

Member since Nov 2025

The Art of the Prompt
FREE

From the Author

The Art of the Prompt

Get on Amazon

Related Prompts

â–² 87

Ultimate Python Debugging Assistant

Claude Sonnet 4.5
â–² 52

React Component Generator with TypeScript

Claude Sonnet 4.5
â–² 29

API Documentation Writer

Claude Sonnet 4.5
â–² 48

Code Refactoring Expert

Claude Sonnet 4.5

Explore More

More Coding prompts →All Claude Sonnet 4.5 prompts →
Godly Prompts

The largest community-driven collection of AI prompts. Find, share, and vote on prompts that actually work.

Categories

  • Coding
  • Writing
  • Business
  • Research
  • Creative
  • Productivity

AI Models

  • ChatGPT / GPT-5
  • Claude 4
  • Gemini 3
  • Grok 4
  • Llama 4

Resources

  • Submit a Prompt
  • Leaderboard
  • About the Author
  • 📚 Get the Book
  • RSS Feed

Legal

  • Privacy Policy
  • Terms of Service
  • Contact Us

© 2025 Godly Prompts. All rights reserved.

Made with passion for the AI community