SQL Server: Determine Total Number of Logical and Physical Reads

sql serversql-server-2008

I am working on the optimization of a SP which contains some business logic using looping. I have removed the looping and converted those piece of code into some simple insert/update statements.

Now I've to do benchmarking and compare old and new code in terms of execution time and logical/physical reads.

My problem is because of the loop in my old code, how can I determine what is the total no of logical/physical reads. Because in SSMS, I can see thousands of IO stats statements like:

"Table 'Employee'. Scan count 1, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 43, lob physical reads 0, lob read-ahead reads 0."

Best Answer

I can think of 3 options to get the total reads:

  1. Extended Event session
  2. SQL Profiler
  3. IO Statistics Parser

IO Statistics Parser is pretty simple, just copy/paste your STATISTICS IO output and voila!