r/SQLServer • u/markinatlanta • 50m ago
Discussion Would a 347 ms query make your tuning list?
Happy Thanksgiving all.
I was looking through some of our SQL Server performance reports when I saw this query and thought I'd share. So it averaged 347 ms per execution, which I probably would’ve scrolled past on a list sorted by duration admiteddly! Then I saw the reads column which was nearly 600,000 logical reads per call seemed worth a closer look.
We added an index on dbo.Products with _MfrCode as the key and ProductCode as an included column. Before and after:
| Average per execution | Before | After |
|---|---|---|
| Elapsed time | 347 ms | 19 ms |
| Logical reads | 597,546 | 566 |
That works out to 596,980 fewer logical reads per call. At 15,000 executions a day, the assumption we used in the report, that’s roughly 9 billion fewer logical reads a day.
Let me know your thoughts