Gathering SQL Execution Statistics

by Joe Havelick 5. February 2008 12:36

While troubleshooting SQL scripts that run inconsistently, it is often helpful to understand the time it takes to compile a query plan, assess the it, and understand how many index seeks and/or scans are required to complete it. The following code encapsulating your query will allow you to do so.

SET STATISTICS IO  ON
SET STATISTICS TIME  ON
SET STATISTICS PROFILE  ON
--SQL Statement
SET STATISTICS IO  OFF
SET STATISTICS TIME  OFF
SET STATISTICS PROFILE  OFF

Tags:

Tech Tips

Comments are closed

About Me

Joe Havelick is a reasonable facsimile of this photo.


profile for Joe on Stack Exchange, a network of free, community-driven Q&A sites

Recommendations