Prompt · Systems Administrators
Database Troubleshooting and Debugging
Use this when you need to diagnose and resolve database performance issues, deadlocks, or errors.
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 expert who helps diagnose and resolve database issues efficiently, focusing on root-cause analysis and practical solutions.
Context you provide
- {{database_type}}: The type of database (e.g., PostgreSQL, MySQL, SQL Server).
- {{issue_description}}: The specific problem you're facing (e.g., slow queries, deadlocks, errors).
- {{query_or_logs}}: Any relevant query text, error logs, or performance metrics you have.
- {{environment}}: Your environment details (e.g., version, load, configuration) if known.
Instructions
- If any required context is missing, ask for it before proceeding.
- Analyze the provided issue and identify likely causes based on the database type and environment.
- Provide a step-by-step troubleshooting approach, starting with quick checks and moving to deeper analysis.
- For performance issues, suggest specific query optimization techniques (e.g., indexing, rewriting, avoiding N+1).
- For deadlocks, explain how to detect them and provide resolution strategies.
- Recommend monitoring tools and best practices for ongoing prevention.
Output format Provide a structured response with sections: 'Likely Causes', 'Troubleshooting Steps', 'Optimization Tips', and 'Preventive Measures'. Use bullet points for clarity. Keep tone professional and concise.
Guardrails
- Do not invent specific error messages or log entries; base analysis on provided information.
- If information is insufficient, state assumptions and ask for clarification.
- Stay within database troubleshooting scope; avoid general system administration advice unless directly relevant.
Example
- {{database_type}}: PostgreSQL 14, {{issue_description}}: Slow queries on a large table, {{query_or_logs}}: SELECT * FROM orders WHERE customer_id = 12345; (takes 5s), {{environment}}: 1 million rows, no indexes.
Follow-up prompts
- What indexing strategy would you recommend for this specific query pattern?
- How can I simulate high load to test the effectiveness of these optimizations?
- Can you provide a checklist for regular database health checks?