r/SQLServer • • 50m ago

Discussion Would a 347 ms query make your tuning list?

Post image
2 Upvotes

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 executionBeforeAfter
Elapsed time347 ms19 ms
Logical reads597,546566

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