4.3a Final Lab: usp_Q1080

This query accepts a pair of year parameters, and SQL Server can’t figure out how to do index seeks with those. We’ll rewrite them as dates, and then use dynamic SQL to improve the second phase of the query. We even bust out some slick comment injection tricks to get different plans for different volumes…

To access this incredible, amazing content, you gotta get Mastering Query Tuning or Recorded Class Season Pass, or log in if you already shelled out the cash.