coding

SQL Query Optimizer

Use this prompt to generate optimized sql + analysis for backend developers & data engineers with clearer context, constraints, and output structure.

What This Prompt Does

This prompt guides an AI model toward a specific optimized sql + analysis output instead of a broad generic answer.

It is written for backend developers & data engineers who need a faster first draft, clearer structure, and fewer follow-up corrections.

The template works with ChatGPT, Claude, Gemini, and Grok when you replace the bracketed inputs with real details.

When to Use It

Use it when you need a reliable optimized sql + analysis draft without starting from a blank chat.

It works best when your goal, audience, tone, examples, and constraints are specific.

Use the first answer as a draft, then ask the model to refine, shorten, expand, or adapt it for your final channel.

Best For:Backend Developers & Data Engineers

Example Input

Goal: create a optimized sql + analysis for backend developers & data engineers
Audience: [describe who will read or use it]
Tone: [clear, practical, persuasive, friendly, formal]
Constraints: [word count, format, platform, examples, must-include points]

Example Output

Sample output:
- Problem summary: restate the bug or build goal in plain language
- Recommended approach: list the safest implementation steps
- Code or checklist: provide the draft solution with edge cases and testing notes

Useful Variations

  • Make the output shorter and more actionable for backend developers & data engineers.
  • Rewrite the answer for a beginner audience and include concrete examples.
  • Turn the result into a checklist, table, or step-by-step workflow.

Customization Tips

  • Add real names, examples, target platform, and desired length before running the prompt.
  • Tell the model what a bad answer looks like so it avoids generic output.
  • Ask for one revision focused only on accuracy, clarity, or conversion depending on your goal.

Best Model to Use

Use Claude, ChatGPT, or Gemini with a clear code context and expected output format.

Expected Output

  • A structured optimized sql + analysis tailored to backend developers & data engineers.
  • Clear sections, bullets, or steps that are easy to edit.
  • A final answer that can be shortened, expanded, reformatted, or adapted for a specific platform.

Common Mistakes

  • Running the prompt without replacing placeholders with real context.
  • Asking for a final answer before defining audience, goal, tone, and constraints.
  • Publishing the output without checking facts, examples, links, claims, or brand voice.

The Prompt

Copy-Paste Ready
You are a database performance expert. Optimize the following SQL query: Database: [MySQL / PostgreSQL / SQLite / SQL Server] Table Size: [APPROXIMATE ROWS] Current Query Execution Time: [e.g. 3.2 seconds] Current Query: ```sql [PASTE YOUR SQL QUERY] ``` Table Schemas (if relevant): ``` [PASTE TABLE STRUCTURE] ``` Provide: 1. Analysis of why the query is slow (explain plan) 2. Optimized query version 3. Index recommendations (which columns, why) 4. Query execution time estimate after optimization 5. Alternative approaches (CTEs, window functions, etc.) 6. Database-specific tips for your DB type 7. Monitoring queries to prevent future slowdowns Show before/after comparison clearly.

How to Get Better Results

  • Replace generic placeholders with real audience, goal, product, topic, tone, and constraints.
  • Ask the model to create one draft first, then request revisions for clarity, length, examples, or formatting.
  • For important work, verify facts and adapt the final output to your own voice before publishing.
  • For coding workflows, compare the output against your actual task instead of judging only the first response.

Related AI Resources

Pair this prompt with supporting pages across the site to get better output and compare alternatives.