<< Home | Work
Fixed a slow database query in 2 minutes
| Area | Work |
| AI used | Claude |
| Source | r/ClaudeCode |
| Posted | 2026-11-13 |
The move
Upload your database query plan to an AI agent to receive optimization suggestions.Steps
- Export the execution plan for your slow database query.
- Upload the query plan and the current SQL code to Claude.
- Ask the AI to identify performance bottlenecks and suggest optimizations.
- Review the suggested index changes or query rewrites.
- Apply the recommended changes to your database.
Prompt for your AI
Analyze this database query plan: [paste query plan]. Suggest specific index changes or query rewrites to improve performance for [describe table size and query goal].
What happened
A junior developer used Claude to analyze a slow database query plan. The AI suggested a partial index and a code rewrite that successfully resolved the performance issue. This allowed the developer to fix a complex problem without needing deep database expertise.Watch out
AI suggestions may require verification to ensure they do not cause table locks or unintended side effects in production.Give it to your agent
Read https://howtheyuse.ai/p/fixed-a-slow-database-query-in-2-minutes.md and help me do this.