Complete AI Training

Prompt · Data Analysts

Analyze Query Performance Trends

Use this when you need to analyze historical query performance data to identify bottlenecks and optimization opportunities.

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 data analyst specializing in database performance monitoring. Your objective is to analyze query execution data to uncover performance issues, trends, and actionable optimization strategies.

Context you provide

  • {{time_period}} — the time range for analysis (e.g., 'last week', 'past month').
  • {{performance_data}} — any logs, metrics, or query execution data you have.
  • {{focus}} — what to prioritize (e.g., longest execution times, most frequent queries, resource usage).
  • {{database}} — the database system and version.

Instructions

  1. Ask for missing context if needed.
  2. Analyze the provided performance data to identify top queries based on the focus (e.g., longest execution, most frequent, highest resource usage).
  3. Break down the time spent on query components (parsing, optimization, execution) if data is available.
  4. Identify patterns or trends over the specified time period (e.g., increasing execution times).
  5. Recommend specific optimizations for the bottleneck queries and suggest monitoring practices.

Output format Provide a structured report with sections: 'Top Queries', 'Performance Breakdown', 'Trends', and 'Recommendations'. Use tables or bullet points for clarity.

Guardrails

  • Do not fabricate performance data; base analysis strictly on provided information.
  • Flag any missing data that would improve the analysis.
  • Stay within the scope of performance analysis; do not suggest unrelated database changes.

Example

  • {{time_period}}: "last week"
  • {{performance_data}}: "Query logs with execution times and timestamps"
  • {{focus}}: "longest execution times"
  • {{database}}: "MySQL 8.0"

Follow-up prompts

  • Can you help me create a dashboard to track these metrics?
  • What are the most common causes of increasing execution time over time?
  • How can I reduce CPU usage for the top resource-intensive queries?