Skip to content

Commit 010d2f5

Browse files
Merge pull request #37025 from WilliamDAssafMSFT/20260407-fabric-linkage
20260407 edit pass
2 parents 7fecdd8 + 0dea113 commit 010d2f5

2 files changed

Lines changed: 82 additions & 67 deletions

File tree

docs/relational-databases/performance/live-query-statistics.md

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Live Query Statistics"
33
description: Learn how to view the live execution plan of an active query in SQL Server Management Studio. Use the execution statistics to debug query performance issues.
44
author: MikeRayMSFT
55
ms.author: mikeray
6-
ms.date: "11/21/2018"
6+
ms.date: 04/07/2026
77
ms.service: sql
88
ms.subservice: performance
99
ms.topic: how-to
@@ -19,60 +19,66 @@ helpviewer_keywords:
1919
- "lightweight profiling"
2020
monikerRange: "=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb"
2121
---
22-
# Live Query Statistics
22+
# Live query statistics
23+
2324
[!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB](../../includes/applies-to-version/sql-asdb-asdbmi-fabricsqldb.md)]
2425

25-
[!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] provides the ability to view the live execution plan of an active query. This live query plan provides real-time insights into the query execution process as the controls flow from one [query plan operator](../../relational-databases/showplan-logical-and-physical-operators-reference.md) to another. The live query plan displays the overall query progress and operator-level run-time execution statistics such as the number of rows produced, elapsed time, operator progress, etc. Because this data is available in real time without needing to wait for the query to complete, these execution statistics are extremely useful for debugging query performance issues. This feature is available starting with [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)] [!INCLUDE[ssManStudio](../../includes/ssmanstudio-md.md)], however it can work with [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)].
26+
[!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] provides the ability to view the live execution plan of an active query. This live query plan provides real-time insights into the query execution process as the controls flow from one [query plan operator](../showplan-logical-and-physical-operators-reference.md) to another. The live query plan displays the overall query progress and operator-level run-time execution statistics such as the number of rows produced, elapsed time, operator progress, and more.
27+
28+
Because you can access this data in real time without needing to wait for the query to complete, these execution statistics are extremely useful for debugging query performance problems.
29+
30+
Internally, live query statistics use the [sys.dm_exec_query_profiles](../system-dynamic-management-views/sys-dm-exec-query-profiles-transact-sql.md) DMV.
2631

27-
> [!NOTE]
28-
> Internally, live query statistics leverages the [sys.dm_exec_query_profiles](../../relational-databases/system-dynamic-management-views/sys-dm-exec-query-profiles-transact-sql.md) DMV.
29-
30-
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] (starting with [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)]) and [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)].
31-
3232
> [!WARNING]
33-
> This feature is primarily intended for troubleshooting purposes. Using this feature can moderately slow the overall query performance, especially in [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)]. For more information, see [Query Profiling Infrastructure](../../relational-databases/performance/query-profiling-infrastructure.md).
34-
> This feature can be used with the [Transact-SQL Debugger](../../ssdt/debugger/configure-firewall-rules-before-running-tsql-debugger.md).
35-
36-
## To view live query statistics for one query
37-
38-
1. To view the live query execution plan, on the tools menu click the **Include Live Query Statistics** icon.
39-
40-
![Live Query Stats button on toolbar](../../relational-databases/performance/media/livequerystatstoolbar.png "Live Query Stats button on toolbar")
41-
42-
You can also view access the live query execution plan by right-clicking on a selected query in [!INCLUDE[ssManStudio](../../includes/ssmanstudio-md.md)] and then click **Include Live Query Statistics**.
43-
44-
![Live Query Stats button on popup menu](../../relational-databases/performance/media/livequerystatsmenu.png "Live Query Stats button on popup menu")
45-
46-
2. Now execute the query. The live query plan displays the overall query progress and the run-time execution statistics (e.g. elapsed time, progress, etc.) for the query plan operators. The query progress information and execution statistics are periodically updated while query execution is in progress. Use this information to understand the overall query execution process and to debug long running queries, queries that run indefinitely, queries that cause tempdb overflow, and timeout issues.
47-
48-
![Live Query Stats button in showplan](../../relational-databases/performance/media/livequerystatsplan.png "Live Query Stats button in showplan")
49-
50-
## To view live query statistics for any query
51-
52-
The live execution plan can also be accessed from the **[Activity Monitor](../../relational-databases/performance-monitor/activity-monitor.md)** by right-clicking on any query in the **Processes** or **Active Expensive Queries** table.
53-
54-
![Live Query Stats button in Activity Monitor](../../relational-databases/performance/media/livequerystatsactmon.png "Live Query Stats button in Activity Monitor")
55-
56-
## Remarks
57-
The statistics profile infrastructure must be enabled before live query statistics can capture information about the progress of queries. Depending on the version, the overhead may be significant. For more information on this overhead, see [Query Profiling Infrastructure](../../relational-databases/performance/query-profiling-infrastructure.md).
58-
59-
## Permissions
60-
Requires the database level `SHOWPLAN` permission to populate the **Live Query Statistics** results page, and requires any permissions necessary to execute the query.
61-
On [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], requires the server level `VIEW SERVER STATE` permission to see the live statistics.
62-
On [!INCLUDE[ssSDS](../../includes/sssds-md.md)] Premium Tiers, requires the `VIEW DATABASE STATE` permission in the database to see the live statistics. On [!INCLUDE[ssSDS](../../includes/sssds-md.md)] Standard and Basic Tiers, requires the **Server admin** or **Microsoft Entra admin** account to see the live statistics.
63-
33+
> This feature is primarily intended for troubleshooting purposes. Using this feature can moderately slow the overall query performance, especially in [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)]. For more information, see [Query Profiling Infrastructure](query-profiling-infrastructure.md).
34+
> You can use this feature with the [Transact-SQL debugger](../../ssdt/debugger/configure-firewall-rules-before-running-tsql-debugger.md).
35+
36+
<a id="to-view-live-query-statistics-for-one-query"></a>
37+
38+
## View live query statistics for one query
39+
40+
1. To view the live query execution plan, on the tools menu, select the **Include Live Query Statistics** icon.
41+
42+
:::image type="content" source="../../relational-databases/performance/media/livequerystatstoolbar.png" alt-text="Screenshot from SQL Server Management Studio, showing the Live Query Stats button on toolbar." lightbox="../../relational-databases/performance/media/livequerystatstoolbar.png":::
43+
44+
You can also access the live query execution plan by right-clicking on a selected query in [!INCLUDE[ssManStudio](../../includes/ssmanstudio-md.md)] and then selecting **Include Live Query Statistics**.
45+
46+
:::image type="content" source="../../relational-databases/performance/media/livequerystatsmenu.png" alt-text="Screenshot from SQL Server Management Studio, showing the Live Query Stats button on popup menu.":::
47+
48+
1. Execute the query. The live query plan displays the overall query progress and the run-time execution statistics (for example, elapsed time or progress) for the query plan operators. The query progress information and execution statistics are periodically updated while query execution is in progress. Use this information to understand the overall query execution process and to debug long running queries, queries that run indefinitely, queries that cause `tempdb` overflow, and timeouts.
49+
50+
:::image type="content" source="../../relational-databases/performance/media/livequerystatsplan.png" alt-text="Screenshot from SQL Server Management Studio, showing the Live Query Stats button in showplan." lightbox="../../relational-databases/performance/media/livequerystatsplan.png":::
51+
52+
<a id="to-view-live-query-statistics-for-any-query"></a>
53+
54+
## View live query statistics for any query
55+
56+
You can also access the live execution plan from **[Activity Monitor](../performance-monitor/activity-monitor.md)** by right-clicking any query in the **Processes** or **Active Expensive Queries** table.
57+
58+
:::image type="content" source="../../relational-databases/performance/media/livequerystatsactmon.png" alt-text="Screenshot of Live Query Stats button in Activity Monitor.":::
59+
60+
## Remarks
61+
62+
You must enable the statistics profile infrastructure before live query statistics can capture information about the progress of queries. Depending on the version, the overhead can be significant. For more information about this overhead, see [Query Profiling Infrastructure](query-profiling-infrastructure.md).
63+
64+
## Permissions
65+
66+
- To populate the **Live Query Statistics** results page, you need the database level `SHOWPLAN` permission, and any permissions necessary to execute the query.
67+
- On [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], you need the server level `VIEW SERVER STATE` permission to see the live statistics.
68+
- On [!INCLUDE[ssSDS](../../includes/sssds-md.md)] Premium Tiers, you need the `VIEW DATABASE STATE` permission in the database to see the live statistics. On [!INCLUDE[ssSDS](../../includes/sssds-md.md)] Standard and Basic Tiers, you need the **Server admin** or **Microsoft Entra admin** account to see the live statistics.
69+
6470
[!INCLUDE [entra-id](../../includes/entra-id.md)]
6571

66-
## See Also
67-
[Execution Plans](../../relational-databases/performance/execution-plans.md)
68-
[Query Processing Architecture Guide](../../relational-databases/query-processing-architecture-guide.md)
69-
[Monitor and Tune for Performance](../../relational-databases/performance/monitor-and-tune-for-performance.md)
70-
[Performance Monitoring and Tuning Tools](../../relational-databases/performance/performance-monitoring-and-tuning-tools.md)
71-
[Open Activity Monitor &#40;SQL Server Management Studio&#41;](../../relational-databases/performance-monitor/open-activity-monitor-sql-server-management-studio.md)
72-
[Activity Monitor](../../relational-databases/performance-monitor/activity-monitor.md)
73-
[Monitoring Performance By Using the Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)
74-
[sys.dm_exec_query_statistics_xml](../../relational-databases/system-dynamic-management-views/sys-dm-exec-query-statistics-xml-transact-sql.md)
75-
[sys.dm_exec_query_profiles](../../relational-databases/system-dynamic-management-views/sys-dm-exec-query-profiles-transact-sql.md)
76-
[Set trace flags with DBCC TRACEON](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md)
77-
[Showplan Logical and Physical Operators Reference](../../relational-databases/showplan-logical-and-physical-operators-reference.md)
78-
[Query Profiling Infrastructure](../../relational-databases/performance/query-profiling-infrastructure.md)
72+
## Related content
73+
74+
- [Execution plan overview](execution-plans.md)
75+
- [Query processing architecture guide](../query-processing-architecture-guide.md)
76+
- [Monitor and Tune for Performance](monitor-and-tune-for-performance.md)
77+
- [Performance monitoring and tuning tools](performance-monitoring-and-tuning-tools.md)
78+
- [Open Activity Monitor in SQL Server Management Studio (SSMS)](../performance-monitor/open-activity-monitor-sql-server-management-studio.md)
79+
- [Activity Monitor](../performance-monitor/activity-monitor.md)
80+
- [Monitor performance by using the Query Store](monitoring-performance-by-using-the-query-store.md)
81+
- [sys.dm_exec_query_statistics_xml](../system-dynamic-management-views/sys-dm-exec-query-statistics-xml-transact-sql.md)
82+
- [sys.dm_exec_query_profiles](../system-dynamic-management-views/sys-dm-exec-query-profiles-transact-sql.md)
83+
- [Logical and physical showplan operator reference](../showplan-logical-and-physical-operators-reference.md)
84+
- [Query Profiling Infrastructure](query-profiling-infrastructure.md)

docs/t-sql/statements/create-security-policy-transact-sql.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "CREATE SECURITY POLICY (Transact-SQL)"
33
description: CREATE SECURITY POLICY a security policy for use with row-level security.
44
author: VanMSFT
55
ms.author: vanto
6-
ms.date: 10/04/2023
6+
ms.date: 04/08/2026
77
ms.service: sql
88
ms.subservice: t-sql
99
ms.topic: reference
@@ -30,7 +30,13 @@ monikerRange: "=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-20
3030

3131
[!INCLUDE [sqlserver2016-asdb-asdbmi-fabricse-fabricdw-fabricsqldb](../../includes/applies-to-version/sqlserver2016-asdb-asdbmi-fabricse-fabricdw-fabricsqldb.md)]
3232

33-
Creates a security policy for [row-level security](../../relational-databases/security/row-level-security.md).
33+
Creates a security policy for [row-level security](../../relational-databases/security/row-level-security.md) in the SQL Database Engine.
34+
35+
:::moniker range="=fabric"
36+
37+
Row-level security in Fabric Data Warehouse operates similarly to other SQL Database Engine products. For more information and examples of row-level security in Fabric Data Warehouse or the SQL analytics endpoint, see [Row-level security in Fabric data warehousing](/fabric/data-warehouse/row-level-security).
38+
39+
:::moniker-end
3440

3541
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3642

@@ -54,27 +60,30 @@ CREATE SECURITY POLICY [schema_name. ] security_policy_name
5460

5561
#### *security_policy_name*
5662

57-
The name of the security policy. Security policy names must comply with the rules for identifiers and must be unique within the database and to its schema.
63+
The name of the security policy. Security policy names must follow the rules for identifiers and be unique within the database and its schema.
5864

5965
#### *schema_name*
6066

61-
Is the name of the schema to which the security policy belongs. *schema_name* is required because of schema binding.
67+
The name of the schema to which the security policy belongs. *schema_name* is required because of schema binding.
6268

6369
#### [ FILTER | BLOCK ]
6470

65-
The type of security predicate for the function being bound to the target table. `FILTER` predicates silently filter the rows that are available to read operations. `BLOCK` predicates explicitly block write operations that violate the predicate function.
71+
The type of security predicate for the function to bind to the target table.
72+
73+
- `FILTER` predicates silently filter the rows that are available to read operations.
74+
- `BLOCK` predicates explicitly block write operations that violate the predicate function.
6675

6776
#### *tvf_schema_name.security_predicate_function_name*
6877

69-
Is the inline table value function that will be used as a predicate and that will be enforced upon queries against a target table. At most one security predicate can be defined for a particular DML operation against a particular table. The inline table value function must have been created using the `SCHEMABINDING` option.
78+
The inline table value function that will be used as a predicate and that will be enforced upon queries against a target table. At most one security predicate can be defined for a particular DML operation against a particular table. The inline table value function must have been created using the `SCHEMABINDING` option.
7079

7180
#### { *column_name* | *expression* }
7281

73-
A column name or expression used as a parameter for the security predicate function. Any column on the target table can be used. An [Expression](../../t-sql/language-elements/expressions-transact-sql.md) can only include constants, built in scalar functions, operators and columns from the target table. A column name or expression needs to be specified for each parameter of the function.
82+
A column name or expression used as a parameter for the security predicate function. Any column on the target table can be used. An [Expression](../../t-sql/language-elements/expressions-transact-sql.md) can only include constants, built in scalar functions, operators, and columns from the target table. A column name or expression needs to be specified for each parameter of the function.
7483

7584
#### *table_schema_name.table_name*
7685

77-
Is the target table to which the security predicate will be applied. Multiple disabled security policies can target a single table for a particular DML operation, but only one can be enabled at any given time.
86+
The target table to which the security predicate will be applied. Multiple disabled security policies can target a single table for a particular DML operation, but only one can be enabled at any given time.
7887

7988
#### *block_dml_operation*
8089

@@ -94,26 +103,26 @@ CREATE SECURITY POLICY [schema_name. ] security_policy_name
94103

95104
#### [ *table_schema_name*. ] *table_name*
96105

97-
Is the target table to which the security predicate will be applied. Multiple disabled security policies can target a single table, but only one can be enabled at any given time.
106+
The target table to which the security predicate will be applied. Multiple disabled security policies can target a single table, but only one can be enabled at any given time.
98107

99108

100109
## Remarks
101110

102111
When using predicate functions with memory-optimized tables, you must include `SCHEMABINDING` and use the `WITH NATIVE_COMPILATION` compilation hint.
103112

104-
Block predicates are evaluated after the corresponding DML operation is executed. Therefore, there is danger that a READ UNCOMMITTED query can see transient values that will be rolled back.
105-
113+
Block predicates are evaluated after the corresponding DML operation is executed. Therefore, there is danger that a `READ UNCOMMITTED` query can see transient values that will be rolled back.
114+
106115
## Permissions
107116

108-
Requires the ALTER ANY SECURITY POLICY permission and ALTER permission on the schema.
117+
Requires the `ALTER ANY SECURITY POLICY` permission and `ALTER` permission on the schema.
109118

110119
Additionally the following permissions are required for each predicate that is added:
111120

112-
- SELECT and REFERENCES permissions on the function being used as a predicate.
121+
- `SELECT` and `REFERENCES` permissions on the function being used as a predicate.
113122

114-
- REFERENCES permission on the target table being bound to the policy.
123+
- `REFERENCES` permission on the target table being bound to the policy.
115124

116-
- REFERENCES permission on every column from the target table used as arguments.
125+
- `REFERENCES` permission on every column from the target table used as arguments.
117126

118127
## Examples
119128

0 commit comments

Comments
 (0)