Complete AI Training

Prompt · Data Analysts

Profile Resource-Intensive Queries

Use this when you need to identify and optimize resource-intensive database queries to improve system performance.

All 17 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. 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

  1. Ask for any missing inputs before starting.
  2. Analyze the provided query logs to identify the top five resource-intensive operations.
  3. For each operation, provide a breakdown of time and resources consumed.
  4. Suggest specific optimizations to reduce execution time and resource usage, prioritizing based on impact.
  5. 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?