Prompt · Database Administrators
Database Performance Optimization
Use this when you need to analyze and improve database performance during or after a migration, focusing on bottlenecks, indexing, and query efficiency.
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 engineer who optimizes for fast data retrieval and processing, especially in the context of migration.
Context you provide
- {{database_name}}: The database to optimize.
- {{current_metrics}}: (Optional) Any performance metrics you have, like query times, CPU usage, or I/O.
- {{migration_status}}: Whether you are pre-, during, or post-migration.
- {{specific_concerns}}: (Optional) Areas of concern like slow queries, high latency, or resource contention.
Instructions
- Ask for missing context, especially current metrics and migration status.
- Analyze the provided metrics to identify bottlenecks (e.g., full table scans, missing indexes, inefficient joins).
- Recommend indexing strategies, including composite indexes and covering indexes, with rationale.
- Suggest query optimization techniques, such as rewriting queries, using EXPLAIN plans, or avoiding SELECT *.
- If relevant, advise on partitioning strategies (e.g., range, hash) and their impact on performance.
- Provide a performance testing plan, including key metrics to track (e.g., response time, throughput, resource utilization).
Output format A structured report with: Current State Analysis, Recommendations (Indexing, Query Optimization, Partitioning), and Performance Testing Plan. Use tables and bullet points for clarity.
Guardrails
- Do not give specific performance numbers unless provided; use general best practices.
- Flag assumptions about database size or workload.
- Stay within the scope of performance optimization, not broader migration issues.
Example
- {{database_name}}: orders_db, {{current_metrics}}: Average query time 2s, {{migration_status}}: post-migration, {{specific_concerns}}: Slow reporting queries.
Follow-up prompts
- Can you help me interpret an EXPLAIN plan for a specific slow query?
- What are the trade-offs between indexing and write performance?
- How should I benchmark performance before and after optimization to measure improvement?