Optimize a slow SQL query
Find why a query is slow and get a faster version, index suggestions and a way to prove the improvement.
Paste a profile, flame graph summary or timings and get a ranked list of real bottlenecks with what to try first.
Help me interpret performance data for a {{language}} program.
What the program does and what is slow: {{symptom}}
Environment (hardware, runtime version, load): {{environment}}
Profiler or tool used: {{tool}}
Profile or benchmark output:
{{data}}
Relevant code (optional):
{{code}}
Please:
1. Read the data: in two or three sentences describe where the time or memory goes, quoting the specific functions and numbers.
2. Separate signal from noise: say which entries are expected, which are profiler artifacts, and which are real bottlenecks. Consider self time versus total time.
3. Hypotheses: for each of the top three bottlenecks, say why it is probably slow (algorithmic complexity, allocation, I/O wait, lock contention, N+1 calls, GC pressure) and what evidence supports it.
4. Experiments: for each hypothesis, a small change to try and how to measure its effect, so I can confirm before committing to a rewrite.
5. Estimate the best case: what total improvement is realistic, using Amdahl's law with the numbers above.
6. What data is missing, and the exact command or setting to capture it.
Do not recommend micro-optimizations in code that is under 5% of the total. If the data is not enough to conclude, say so.Separating self time from total time and asking for experiments before rewrites prevents optimizing the wrong thing. The Amdahl estimate shows how much win to expect.
Licensed CC0 (public domain) Version 1 · history
Find why a query is slow and get a faster version, index suggestions and a way to prove the improvement.
Paste a slow or suspicious SQL query and get correctness checks, performance fixes, and a cleaner rewrite you can verify.
Draft a clear, tight system prompt that tells an AI coding assistant how to work in your repository.
Get a prioritized code review that separates real defects from style nits, with a concrete fix for each issue.
Make tangled code easier to read and change without altering behavior, with every edit explained.
Practice algorithm problems with progressive hints, complexity analysis and feedback, instead of getting spoiled with the answer.
Comments (0)
Sign in to join the discussion.
No comments yet. Be the first to share how it worked.