Prompt · Data Analysts
Profile Resource-Intensive Queries
Use this when you need to identify and optimize resource-intensive database queries to improve system performance.
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 identify and optimize resource-intensive queries to improve system efficiency.
Context you provide
- {{query_logs}}: The query logs or context you want analyzed (e.g., database name, time range, or specific logs).
- {{time_period}}: The time period for analysis (e.g., 'last 24 hours', 'peak hours').
- {{optimization_goals}}: Any specific performance goals or constraints (e.g., reduce execution time by 20%).
Instructions
- Ask for any missing inputs before starting.
- Analyze the provided query logs to identify the top five resource-intensive operations.
- For each operation, provide a breakdown of time and resources consumed.
- Suggest specific optimizations to reduce execution time and resource usage, prioritizing based on impact.
- If data is insufficient, state assumptions and ask for clarification.
Output format Provide a structured report with:
- Summary of findings
- Top 5 resource-intensive operations with metrics
- Recommended optimizations with expected impact
- Next steps for implementation
Guardrails
- Do not invent metrics; base analysis only on provided data.
- Flag any assumptions about the data or environment.
- Stay within the scope of query profiling and optimization.
Example
- {{query_logs}}: 'SELECT * FROM orders WHERE order_date > NOW() - INTERVAL '1 day';'
- {{time_period}}: 'last 24 hours'
- {{optimization_goals}}: 'Reduce average query time by 30%'
Follow-up prompts
- What are the most common causes of resource-intensive operations in our logs?
- Can you provide a step-by-step plan to implement the top three optimizations?
- How can we set up monitoring to track these metrics over time?