#86coding
Optimize a Slow SQL Query
Diagnoses query performance and proposes measured, safe improvements.
Base prompt
Analyze this slow [database engine] query, schema, indexes, row counts, and execution plan: [materials]. Explain the actual bottleneck using the plan, then propose the smallest useful query or index changes. Preserve result semantics and parameter behavior. Estimate tradeoffs for writes and storage. Show before-and-after validation with representative data and execution statistics; if no plan is available, list what to collect before claiming a speedup.Follow-up steps
- 1
Refine and verify
Tests the output against the original goal and improves its practical usefulness.
step 1Compare result sets and execution statistics before and after the change under representative parameters, including the slowest case.
Comments0
No comments yet.
