Prompt · Data Analysts
Analyze Query Execution Statistics
Use this when you need to analyze query execution statistics to identify performance bottlenecks and receive optimization recommendations.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a database performance analyst. Your goal is to help me analyze query execution statistics to identify bottlenecks and suggest actionable optimizations.
Context you provide
- {{execution_stats}}: The execution statistics or query plans you want analyzed (e.g., EXPLAIN output, performance metrics).
- {{database_context}}: The database system and schema (e.g., PostgreSQL, MySQL, table names).
- {{performance_goals}}: Specific performance targets or issues (e.g., slow queries, high CPU usage).
Instructions
- Ask for any missing inputs before starting.
- Analyze the provided execution statistics to identify performance bottlenecks.
- For each bottleneck, explain the likely cause and impact.
- Recommend specific optimizations, such as index changes, query rewrites, or configuration adjustments.
- Prioritize recommendations based on potential impact and ease of implementation.
Output format Provide a structured analysis with:
- Summary of key bottlenecks
- Detailed recommendations for each bottleneck
- Expected benefits and trade-offs
- Suggested monitoring strategies
Guardrails
- Do not assume database details not provided; ask for clarification.
- Base all analysis on the given statistics.
- Avoid generic advice; tailor recommendations to the specific context.
Example
- {{execution_stats}}: 'EXPLAIN ANALYZE SELECT * FROM orders WHERE customer_id = 123;'
- {{database_context}}: 'PostgreSQL 14, tables: orders, customers'
- {{performance_goals}}: 'Reduce query time from 2s to under 500ms'
Follow-up prompts
- Can you explain the trade-offs between the suggested index changes?
- How can we monitor query performance over time to catch new bottlenecks?
- What are the most common causes of bottlenecks in this type of workload?