SET STATISTICS PROFILE (Transact-SQL)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2008) ![yes](media/yes.png)Azure SQL Database ![no](media/no.png)Azure SQL Data Warehouse ![no](media/no.png)Parallel Data Warehouse

Displays the profile information for a statement. STATISTICS PROFILE works for ad hoc queries, views, and stored procedures.

Topic link icon Transact-SQL Syntax Conventions

Syntax

  
SET STATISTICS PROFILE { ON | OFF }  

Remarks

When STATISTICS PROFILE is ON, each executed query returns its regular result set, followed by an additional result set that shows a profile of the query execution.

The additional result set contains the SHOWPLAN_ALL columns for the query and these additional columns.

Column name Description
Rows Actual number of rows produced by each operator
Executes Number of times the operator has been executed

Permissions

To use SET STATISTICS PROFILE and view the output, users must have the following permissions:

For Transact\-SQL statements that do not produce STATISTICS PROFILE result sets, only the appropriate permissions to execute the Transact\-SQL Transact\-SQL statements are required. For Transact\-SQL Transact\-SQL Transact\-SQL statements that do produce STATISTICS PROFILE result sets, checks for both the Transact\-SQL Transact\-SQL Transact\-SQL Transact\-SQL statement execution permission and the SHOWPLAN permission must succeed, or the Transact\-SQL Transact\-SQL Transact\-SQL Transact\-SQL Transact\-SQL statement execution is aborted and no Showplan information is generated.

See Also

SET Statements (Transact-SQL)
SET SHOWPLAN_ALL (Transact-SQL)
SET STATISTICS TIME (Transact-SQL)
SET STATISTICS IO (Transact-SQL)