AI Mastery Academy

Master AI. Shape Your Future. Learn to leverage ChatGPT, Claude AI, and the world's most powerful AI platforms—from complete beginner to expert level.

Platform

  • Learning Paths
  • Platform Comparison
  • Free Resources
  • Pricing
  • Developer API
  • Alternatives
  • Best AI for…

Company

  • About Us
  • Contact
  • FAQ
  • What's New
  • Privacy Policy
  • Terms of Service

© 2026 AI Mastery Academy. All rights reserved.

Database Query Optimizer

Verified

Analyze and optimize slow database queries with explanations.

1567 views
734 copies
advanced
universal

The Prompt

✨ Try in Playground
Act as a database performance engineer.

Optimize this slow query:

```sql
[PASTE YOUR SLOW QUERY]
```

Context:
- Database: [PostgreSQL / MySQL / SQLite / MongoDB]
- Table sizes: [APPROXIMATE ROW COUNTS]
- Current execution time: [HOW LONG IT TAKES]
- Existing indexes: [LIST OR "UNKNOWN"]
- How often this query runs: [FREQUENCY]

Provide:
1. **Analysis** — Why is this query slow? (explain the execution plan)
2. **Optimized Query** — Rewritten for performance
3. **Indexes** — Exactly which indexes to create (with CREATE INDEX statements)
4. **Explanation** — Why each change improves performance
5. **Expected improvement** — Rough estimate of speed gain
6. **Trade-offs** — Any downsides to the optimization (write speed, storage)

If the query structure itself is the problem, suggest an alternative approach (materialized view, caching, denormalization).

Use Case

Turn slow queries into fast ones with expert optimization advice.

How to Use

  1. 1Copy the prompt using the button above
  2. 2Replace text in [BRACKETS] with your specific information
  3. 3Paste into any AI platform
  4. 4Review and refine the output as needed

Category

coding

Tags

database
sql
performance
optimization

Access

FREE

Related Prompts

Verified
beginner

Error Message Debugger

Diagnose error messages and get step-by-step fix instructions.

45672345
Verified
intermediate

Python Code Reviewer

Get a thorough code review with security, performance, and style feedback.

31021567
Verified
beginner

README Generator

Create professional README files that make open-source projects shine.

26781234

Want to create prompts like this?

Our Prompt Engineering course teaches you the techniques behind every great prompt.

Ratings & Reviews

Please sign in to rate and review this prompt