When query tuning starts too late: a dbForge use case for finding bottlenecks earlier
This keeps happening right before prod deploys.
Most of the time, query tuning doesn't start until something goes wrong. Timeout, alerts, someone staring at execution plans at 2 AM.
The annoying part is the slow query was already there.
It just didn’t hurt yet.
Staging data is usually tiny compared to prod. Dev data is clean, row counts are low, cost estimates look cheap, QA passes.
Then the same query hits real production volume and the plan changes.
Seeks become scans. Nested loops suddenly touch millions of rows. The query that looked harmless is now the problem.
I’ve seen the same thing with waits too. During load testing, IO waits or lock waits start creeping up, but they get ignored because nothing is technically broken yet. Then release happens and everyone acts surprised.
Parameter sniffing is another fun one. SQL Server caches the plan from the first execution, and if those parameters are weird, the cached plan can be terrible for the normal workload.
Some teams try to catch this earlier by profiling while the app is still in staging. Usually the risky queries are the ones with too many reads, CPU spikes, or big estimate gaps. We’ve used regular execution plans and profilers for this, including the query profiler in dbForge Studio when checking SQL Server stuff.
How do people here handle this? Do you look at query performance during staging, or mostly once something breaks in prod?