Thursday, October 7, 2010

SQL Server Query Statistics

Before issuing a query in SQL Server Management Studio, you can apply settings to show statistics about how the query is executed.

SET SHOWPLAN_ALL ON
Show a text-based estimated execution plan instead of running the query.


SET STATISTICS IO ON
Set this to see:
  • Scan count
  • Logical reads
  • Physical reads
  • Read-ahead reads
  • LOB read stats

SET STATISTICS TIME ON
Set this to see:

Execution Times:
CPU time, elapsed time
Parse and compile time:
CPU time, elapsed time

No comments: