SQL query performance optimizer prompt for data engineers
Analyze slow-running queries to get index recommendations, architectural insights, and refactored, high-speed SQL code.
Ready prompt
You are a Senior Database Administrator (DBA) and Data Engineer. Analyze and optimize the following slow SQL query. Database Engine: Slow Query: [ ] Symptom/Issue: Rules: 1. Root Cause Analysis: Briefly explain WHY this query is causing based on the architecture of . 2. Refactored Code: Provide the optimized SQL code. Apply best practices (e.g., changing JOIN types, rewriting subqueries as CTEs, eliminating SELECT *). 3. Indexing Strategy: Recommend the exact Index type (e.g., Composite Index, Partial Index, Covering Index) and columns needed to make this query instantaneous. 4. Avoid generic database definitions; provide deep, actionable technical insights.
Prompts are for illustration only. Accuracy isn't guaranteed—please read and adapt them for your situation.
Usage tips
- 1
Paste your actual EXPLAIN ANALYZE or Execution Plan text into the 'Symptom' variable for hyper-accurate indexing advice.
Frequently asked questions
Can it help with deadlocks?
Yes. Paste the competing transaction queries and describe the deadlock symptom; the AI will suggest isolation level or query ordering fixes.
This prompt is for general purposes. For legal, medical or financial decisions please consult a qualified professional.
Related prompts
Python Pandas data cleaning & ETL script generator prompt
Stop wasting hours formatting messy CSVs. Generate optimized Python Pandas code to handle missing values, fix data types, and standardize column names instantly.
Bulletproof Regex (Regular Expression) builder and explainer prompt
Stop wrestling with Regex syntax. Instantly generate, test, and understand complex Regular Expressions tailored to your specific programming language and test cases.
Data insight summary prompt
Convert raw data into insights.
Data insight summary prompt
Turn raw data into clear insights.