Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 3 KB

set-statistics-profile-transact-sql.md

File metadata and controls

63 lines (48 loc) · 3 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
SET STATISTICS PROFILE (Transact-SQL)
SET STATISTICS PROFILE (Transact-SQL)
WilliamDAssafMSFT
wiassaf
06/10/2016
sql
t-sql
reference
PROFILE
SET_STATISTICS_PROFILE_TSQL
PROFILE_TSQL
SET STATISTICS PROFILE
profiles [SQL Server], displaying
statements [SQL Server], profile information
SET STATISTICS PROFILE statement
STATISTICS PROFILE option
statistical information [SQL Server], profiles
TSQL

SET STATISTICS PROFILE (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]

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

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: 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:

  • Appropriate permissions to execute the [!INCLUDEtsql] statements.

  • SHOWPLAN permission on all databases containing objects that are referenced by the [!INCLUDEtsql] statements.

For [!INCLUDEtsql] statements that do not produce STATISTICS PROFILE result sets, only the appropriate permissions to execute the [!INCLUDEtsql] statements are required. For [!INCLUDEtsql] statements that do produce STATISTICS PROFILE result sets, checks for both the [!INCLUDEtsql] statement execution permission and the SHOWPLAN permission must succeed, or the [!INCLUDEtsql] 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)