GudangPromptgudangprompt
Back to prompts
Coding

SQL Query Optimizer

Analyze and rewrite slow SQL queries for maximum performance. Explains indexing strategies and execution plans.

Quick answer

SQL Query Optimizer is best for coding workflows. It helps you analyze and rewrite slow sql queries for maximum performance. explains indexing strategies and execution plans..

Best for

  • Coding
A
Aryo D.
Creator
174Saves
6.1KUses

How to use

  1. Copy the prompt template.
  2. Replace the bracketed placeholders with your own details.
  3. Run it in ChatGPT, Claude, or another AI tool.

FAQ

What does this prompt help with?

Analyze and rewrite slow SQL queries for maximum performance. Explains indexing strategies and execution plans.

Can I edit it?

Yes — copy it and adapt it to your workflow.

Prompt Template

Act as a senior database engineer. I have the following slow SQL query:

[PASTE QUERY HERE]

The database is [POSTGRES / MYSQL / SQLITE]. The table has approximately [ROW COUNT] rows.

Please:
1. Identify the performance bottlenecks in this query.
2. Rewrite it as an optimized version with explanations for each change.
3. Suggest which columns should be indexed and why.
4. Provide the EXPLAIN ANALYZE output you'd expect after the optimization.