Skip to content

Commit 3a95522

Browse files
authored
Merge pull request #4448 from pmasl/patch-92
Update sys-dm-exec-query-stats-transact-sql.md
2 parents b4c84e6 + 9590730 commit 3a95522

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

docs/relational-databases/system-dynamic-management-views/sys-dm-exec-query-stats-transact-sql.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "sys.dm_exec_query_stats (Transact-SQL) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "08/21/2017"
4+
ms.date: "01/04/2018"
55
ms.prod: "sql-non-specified"
66
ms.prod_service: "database-engine, sql-database"
77
ms.service: ""
@@ -105,10 +105,18 @@ ms.workload: "Active"
105105
|**last_used_threads**|**bigint**|The number of used parallel threads when this plan executed last time. It will always be 0 for querying a memory-optimized table.<br /><br /> **Applies to**: [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].|
106106
|**min_used_threads**|**bigint**|The minimum number of used parallel threads this plan ever used during one execution. It will always be 0 for querying a memory-optimized table.<br /><br /> **Applies to**: [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].|
107107
|**max_used_threads**|**bigint**|The maximum number of used parallel threads this plan ever used during one execution. It will always be 0 for querying a memory-optimized table.<br /><br /> **Applies to**: [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].|
108-
|**pdw_node_id**|**int**|**Applies to**: [!INCLUDE[ssSDWfull](../../includes/sssdwfull-md.md)], [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]<br /><br /> The identifier for the node that this distribution is on.|
108+
|**pdw_node_id**|**int**|The identifier for the node that this distribution is on.<br /><br /> **Applies to**: [!INCLUDE[ssSDWfull](../../includes/sssdwfull-md.md)], [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]|
109+
|**total_columnstore_segment_reads**|**bigint**|The total sum of columnstore segments read by the query. Cannot be null.<br /><br /> **Applies to**: Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3|
110+
|**last_columnstore_segment_reads**|**bigint**|The number of columnstore segments read by the last execution of the query. Cannot be null.<br /><br /> **Applies to**: Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3|
111+
|**min_columnstore_segment_reads**|**bigint**|The minimum number of columnstore segments ever read by the query during one execution. Cannot be null.<br /><br /> **Applies to**: Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3|
112+
|**max_columnstore_segment_reads**|**bigint**|The maximum number of columnstore segments ever read by the query during one execution. Cannot be null.<br /><br /> **Applies to**: Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3|
113+
|**total_columnstore_segment_skips**|**bigint**|The total sum of columnstore segments skipped by the query. Cannot be null.<br /><br /> **Applies to**: Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3|
114+
|**last_columnstore_segment_skips**|**bigint**|The number of columnstore segments skipped by the last execution of the query. Cannot be null.<br /><br /> **Applies to**: Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3|
115+
|**min_columnstore_segment_skips**|**bigint**|The minimum number of columnstore segments ever skipped by the query during one execution. Cannot be null.<br /><br /> **Applies to**: Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3|
116+
|**max_columnstore_segment_skips**|**bigint**|The maximum number of columnstore segments ever skipped by the query during one execution. Cannot be null.<br /><br /> **Applies to**: Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3|
109117

110118
> [!NOTE]
111-
> <sup>1</sup> For natively compiled stored procedures when statistics collection is enabled, worker time is collected in milliseconds. If the query executes in less than a millisecond, the value will be 0.
119+
> <sup>1</sup> For natively compiled stored procedures when statistics collection is enabled, worker time is collected in milliseconds. If the query executes in less than one millisecond, the value will be 0.
112120
113121
## Permissions
114122
On [!INCLUDE[ssNoVersion_md](../../includes/ssnoversion-md.md)], requires `VIEW SERVER STATE` permission.
@@ -122,7 +130,7 @@ On [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)] Premium Tiers, requires the
122130
### A. Finding the TOP N queries
123131
The following example returns information about the top five queries ranked by average CPU time. This example aggregates the queries according to their query hash so that logically equivalent queries are grouped by their cumulative resource consumption.
124132

125-
``` t-sql
133+
```sql
126134
USE AdventureWorks2012;
127135
GO
128136
SELECT TOP 5 query_stats.query_hash AS "Query Hash",
@@ -139,13 +147,12 @@ FROM
139147
CROSS APPLY sys.dm_exec_sql_text(QS.sql_handle) as ST) as query_stats
140148
GROUP BY query_stats.query_hash
141149
ORDER BY 2 DESC;
142-
143150
```
144151

145152
### B. Returning row count aggregates for a query
146153
The following example returns row count aggregate information (total rows, minimum rows, maximum rows and last rows) for queries.
147154

148-
``` t-sql
155+
```sql
149156
SELECT qs.execution_count,
150157
SUBSTRING(qt.text,qs.statement_start_offset/2 +1,
151158
(CASE WHEN qs.statement_end_offset = -1

0 commit comments

Comments
 (0)