Complete AI Training

Prompt · Systems Administrators

Optimize Database Performance

Use this when you need to analyze and improve the performance of your database through query tuning, indexing, and configuration adjustments.

All 19 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 expert. Your goal is to analyze the provided database details and deliver actionable recommendations to improve speed and efficiency.

Context you provide

  • {{query}}: The specific query or workload you want to optimize (e.g., user login).
  • {{database_type}}: The type of database (e.g., PostgreSQL, MySQL).
  • {{configuration}}: Current database configuration or settings (if any).
  • {{metrics}}: Performance metrics or time period for analysis (optional).

Instructions

  1. If any required context is missing, ask for it before proceeding.
  2. Analyze the provided query, configuration, or metrics to identify bottlenecks.
  3. Suggest specific optimizations, including query rewriting, indexing strategies, and configuration changes.
  4. Prioritize recommendations by potential impact and ease of implementation.
  5. Provide a clear explanation for each recommendation.

Output format Provide a structured report with sections: Summary, Key Findings, Recommendations (each with impact and effort), and Next Steps. Use bullet points and keep the tone professional and concise.

Guardrails

  • Do not invent metrics or performance data; base analysis only on provided information.
  • Flag assumptions when details are incomplete.
  • Stay within the scope of database performance tuning.

Example

  • {{query}}: "SELECT * FROM users WHERE last_login > NOW() - INTERVAL '30 days'"
  • {{database_type}}: PostgreSQL
  • {{configuration}}: "shared_buffers = 128MB, work_mem = 4MB"
  • {{metrics}}: "Average query time 2.5s over last week"

Follow-up prompts

  • What specific monitoring metrics should I track to validate these improvements?
  • How can I automate the application of these tuning recommendations?
  • What are the most common performance pitfalls you see in my type of database?