-
Database
Find and fix slow queries with the slow query log
Enables slow query logging, ranks the worst offenders, and fixes them with indexes or rewrites.
Free Prompt
Find my slow queries and fix the worst ones. Enable slow query logging (or the platform's query performance view) with a threshold around 100ms, and seed realistic data volumes if dev data is tiny; queries that look fine on 20 rows are the ones that matter.
For each query over the threshold: get the query plan (EXPLAIN or the platform equivalent); diagnose whether it needs an index, a rewrite, a smaller result set, or a different access pattern; apply the fix; and re-run the plan to confirm the improvement. Fix by evidence, not by sprinkling indexes everywhere: each new index slows down writes, so only add ones a plan justifies. If a query is inherently heavy (reports, exports), move it out of the request cycle instead of tuning it to death.
Don't add indexes without a query plan showing they'll be used. Don't change what any query returns.
Deliver: a table of the slow queries ranked by impact (frequency times duration), the plan before and after each fix, the fixes applied, and verification: each fixed query now under the threshold at realistic data volume.
What This Does / How This Helps
Finds the queries actually slowing your app down and fixes them with evidence, using query plans instead of guessing. Slow query problems don't announce themselves pre-launch because dev data is small. The slow log with realistic data is the rehearsal: you see the 2-second queries now instead of in a launch-week incident. The ranking by impact matters: a 500ms query on your landing page beats a 2-second query in an admin panel. You fix what users actually feel.
Want to skip doing this by hand?
Fortivibe audits your app for all of the areas these prompts cover (and more).