Skip to content

Commit aaeac4b

Browse files
20240717 queryinsights system views updates
Co-authored-by: mariyaali@microsoft.com <mariyaali@users.noreply.github.com>
1 parent e897d06 commit aaeac4b

5 files changed

Lines changed: 136 additions & 52 deletions

docs/relational-databases/system-views/queryinsights-exec-requests-history-transact-sql.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "The queryinsights.exec_requests_history in Microsoft Fabric provid
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: mariyaali
7-
ms.date: 10/30/2023
7+
ms.date: 07/17/2024
88
ms.service: sql
99
ms.topic: "reference"
1010
f1_keywords:
@@ -16,38 +16,40 @@ helpviewer_keywords:
1616
- "query insights frequently_run_queries"
1717
dev_langs:
1818
- "TSQL"
19-
monikerRange: "=fabric"
19+
monikerRange: "=fabric"
2020
---
2121
# queryinsights.exec_requests_history (Transact-SQL)
2222
[!INCLUDE [fabric-se-and-dw](../../includes/applies-to-version/fabric-se-and-dw.md)]
2323

24-
The `queryinsights.exec_requests_history` in [!INCLUDE [fabric](../../includes/fabric.md)] provides information about each complete SQL request.
24+
The `queryinsights.exec_requests_history` in [!INCLUDE [fabric](../../includes/fabric.md)] provides information about each completed SQL request.
2525

2626
| Column name | Data type | Description |
2727
| --- | --- | --- |
28-
|distributed_statement_id | uniqueid | Unique ID for each query.|
29-
|start_time | datetime2 | Time when the query started running.|
30-
|command | varchar(8000) | Complete text of the executed query.|
31-
|login_name | varchar(128) | Name of the user or system that sent the query.|
32-
|row_count | bigint | Number of rows retrieved by the query.|
33-
|total_elapsed_time_ms | int | Total time (ms) taken by the query to finish.|
34-
|status | varchar(30) | Query status (Succeeded, Failed, or Canceled).|
35-
|session_id | smallint | ID linking the query to a specific user session.|
36-
|connection_id | uniqueid (nullable) | Identification number for the query's connection.|
37-
|batch_id | uniqueid (nullable) | ID for grouped queries (if applicable).|
38-
|root_batch_id | uniqueid (nullable) | ID for the main group of queries (if nested).|
28+
| `distributed_statement_id` | **uniqueidentifier** | Unique ID for each query.|
29+
| `start_time` | **datetime2** | Time when the query started running.|
30+
| `command` | **varchar(8000)** | Complete text of the executed query.|
31+
| `login_name` | **varchar(128)** | Name of the user or system that sent the query.|
32+
| `row_count` | **bigint** | Number of rows retrieved by the query.|
33+
| `total_elapsed_time_ms` | **int** | Total time (ms) taken by the query to finish.|
34+
| `status` | **varchar(30)** | Query status: **Succeeded**, **Failed**, or **Cancelled**|
35+
| `session_id` | **smallint** | ID linking the query to a specific user session.|
36+
| `connection_id` | **uniqueidentifier** | Identification number for the query's connection. Nullable.|
37+
| `batch_id` | **uniqueidentifier** | ID for grouped queries (if applicable). Nullable.|
38+
| `root_batch_id` | **uniqueidentifier** | ID for the main group of queries (if nested). Nullable.|
39+
| `query_hash` | **varchar(200)** | Binary hash value calculated on the query and used to identify queries with similar logic. You can use the query hash to correlate between Query Insight views. For more information, see [Query Insights - Aggregation](/fabric/data-warehouse/query-insights#similar-queries).|
3940

4041
## Permissions
4142

4243
You should have access to a [[!INCLUDE [fabric-se](../../includes/fabric-se.md)]](/fabric/data-warehouse/data-warehousing#sql-endpoint-of-the-lakehouse) or [[!INCLUDE [fabric-dw](../../includes/fabric-dw.md)]](/fabric/data-warehouse/data-warehousing#synapse-data-warehouse) within a [Premium capacity](/power-bi/enterprise/service-premium-what-is) workspace with Contributor or above permissions.
4344

45+
## Next step
46+
47+
> [!div class="nextstepaction"]
48+
> [Query insights in Microsoft Fabric](/fabric/data-warehouse/query-insights)
49+
4450
## Related content
4551

4652
- [Monitoring connections, sessions, and requests using DMVs in Microsoft Fabric](/fabric/data-warehouse/monitor-using-dmv)
53+
- [queryinsights.exec_sessions_history (Transact-SQL)](queryinsights-exec-sessions-history-transact-sql.md)
4754
- [queryinsights.long_running_queries (Transact-SQL)](queryinsights-long-running-queries-transact-sql.md)
4855
- [queryinsights.frequently_run_queries (Transact-SQL)](queryinsights-frequently-run-queries-transact-sql.md)
49-
50-
## Next step
51-
52-
> [!div class="nextstepaction"]
53-
> [Query insights in Microsoft Fabric](/fabric/data-warehouse/query-insights)
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: "queryinsights.exec_sessions_history (Transact-SQL)"
3+
description: "The queryinsights.exec_sessions_history in Microsoft Fabric provides information about each user session."
4+
author: WilliamDAssafMSFT
5+
ms.author: wiassaf
6+
ms.reviewer: mariyaali
7+
ms.date: 07/17/2024
8+
ms.service: sql
9+
ms.topic: "reference"
10+
f1_keywords:
11+
- "queryinsights.exec_sessions_history"
12+
- "queryinsights.exec_sessions_history_TSQL"
13+
helpviewer_keywords:
14+
- "queryinsights.exec_sessions_history system view"
15+
- "queryinsights.exec_sessions_history"
16+
- "query insights frequently_run_queries"
17+
dev_langs:
18+
- "TSQL"
19+
monikerRange: "=fabric"
20+
---
21+
# queryinsights.exec_sessions_history (Transact-SQL)
22+
23+
[!INCLUDE [fabric-se-and-dw](../../includes/applies-to-version/fabric-se-and-dw.md)]
24+
25+
The `queryinsights.exec_sessions_history` in [!INCLUDE [fabric](../../includes/fabric.md)] provides information about each completed session.
26+
27+
| **Column name** | **Data type** | **Description** |
28+
| :-- | :-- | :-- |
29+
| `session_id` | **smallint** | Identifies the session associated with each active primary connection. It is not nullable. |
30+
| `connection_id` | **uniqueidentifier** | Identifies each connection uniquely. It is not nullable. |
31+
| `session_start_time` | **datetime2** | Time when session was established. It is not nullable. |
32+
| `session_end_time` | **datetime2** | Time when the session was disconnected. Sessions that have not completed at the time this view is queried are shown with a value of `1900-01-01`.|
33+
| `program_name` | **varchar(128)** | Name of client program that initiated the session. The value is `NULL` for internal sessions. Is nullable. |
34+
| `login_name` | **varchar(128)** | SQL Server login name under which the session is currently executing. For the original login name that created the session, see `original_login_name`. Can be a SQL Server authenticated login name or a Windows authenticated domain username. It is not nullable. |
35+
| `status` | **varchar(30)** | Status of the session. Values:<br />**Running** - Currently running one or more requests<br />**Sleeping** - Currently running no requests<br />**Dormant** - Session reset because of connection pooling and is now in prelogin state.<br />**Preconnect** - Session is in the Resource Governor classifier.<br />Is not nullable. |
36+
| `context_info` | **varbinary(128)** | `CONTEXT_INFO` value for the session. The context information is set by the user with [SET CONTEXT_INFO](/sql/t-sql/statements/set-context-info-transact-sql?view=azure-sqldw-latest&preserve-view=true). Is nullable. |
37+
| `total_query_elapsed_time_ms` | **int** | Total time, in milliseconds, for which the session (requests within) was scheduled/executed for execution. It is not nullable. |
38+
| `last_request_start_time` | **datetime2** | Time at which the last request on the session began, including the currently executing request. It is not nullable. |
39+
| `last_request_end_time` | **datetime2** | Time of the last completion of a request on the session. Is nullable. |
40+
| `is_user_process` | **bit** | `0` if the session is a system session. Otherwise, it is `1`. It is not nullable. |
41+
| `prev_error` | **int** | ID of the last error returned on the session. It is not nullable. |
42+
| `group_id` | **int** | ID of the workload group to which this session belongs. It is not nullable. |
43+
| `database_id` | **smallint** | ID of the current database for each session. |
44+
| `authenticating_database_id` | **int** | ID of the database authenticating the principal. For logins, the value is `0`. For contained database users, the value is the database ID of the contained database. |
45+
| `open_transaction_count` | **int** | Number of open transactions per session. |
46+
| `text_size` | **int** | `TEXTSIZE` setting for the session. It is not nullable. |
47+
| `language` | **varchar(128)** | `LANGUAGE` setting for the session. Is nullable. |
48+
| `date_format` | **varchar(3)** | `DATEFORMAT` setting for the session. Is nullable. |
49+
| `date_first` | **smallint** | `DATEFIRST` setting for the session. It is not nullable. |
50+
| `quoted_identifier` | **bit** | `QUOTED_IDENTIFIER` setting for the session. It is not nullable. |
51+
| `arithabort` | **bit** | `ARITHABORT` setting for the session. It is not nullable. |
52+
| `ansi_null_dflt_on` | **bit** | `ANSI_NULL_DFLT_ON` setting for the session. It is not nullable. |
53+
| `ansi_defaults` | **bit** | `ANSI_DEFAULTS` setting for the session. It is not nullable. |
54+
| `ansi_warnings` | **bit** | `ANSI_WARNINGS` setting for the session. It is not nullable. |
55+
| `ansi_padding` | **bit** | `ANSI_PADDING` setting for the session. It is not nullable. |
56+
| `ansi_nulls` | **bit** | `ANSI_NULLS` setting for the session. It is not nullable. |
57+
| `concat_null_yields_null` | **bit** | `CONCAT_NULL_YIELDS_NULL` setting for the session. It is not nullable. |
58+
| `transaction_isolation_level` | **smallint** | Transaction isolation level of the session.<br />`0` = Unspecified<br />`1` = ReadUncommitted<br />`2` = ReadCommitted<br />`3` = RepeatableRead<br />`4` = Serializable<br />`5` = Snapshot<br />Is not nullable. |
59+
| `lock_timeout` | **int** | `LOCK_TIMEOUT` setting for the session. The value is in milliseconds. It is not nullable. |
60+
| `deadlock_priority` | **int** | `DEADLOCK_PRIORITY` setting for the session. It is not nullable. |
61+
| `original_security_id` | **varbinary(85)** | [!INCLUDE [msCoName](../../includes/msconame-md.md)] Windows security ID that is associated with the `original_login_name`. Not nullable. |
62+
| `database_name` | **varchar(128)** | Name of the current database for each session. |
63+
64+
## Permissions
65+
66+
You should have access to a [[!INCLUDE [fabric-se](../../includes/fabric-se.md)]](/fabric/data-warehouse/data-warehousing#sql-endpoint-of-the-lakehouse) or [[!INCLUDE [fabric-dw](../../includes/fabric-dw.md)]](/fabric/data-warehouse/data-warehousing#synapse-data-warehouse) within a [Premium capacity](/power-bi/enterprise/service-premium-what-is) workspace with Contributor or above permissions.
67+
68+
## Next step
69+
70+
> [!div class="nextstepaction"]
71+
> [Query insights in Microsoft Fabric](/fabric/data-warehouse/query-insights)
72+
73+
## Related content
74+
75+
- [Monitoring connections, sessions, and requests using DMVs in Microsoft Fabric](/fabric/data-warehouse/monitor-using-dmv)
76+
- [queryinsights.exec_sessions_history (Transact-SQL)](queryinsights-exec-requests-history-transact-sql.md)
77+
- [queryinsights.long_running_queries (Transact-SQL)](queryinsights-long-running-queries-transact-sql.md)
78+
- [queryinsights.frequently_run_queries (Transact-SQL)](queryinsights-frequently-run-queries-transact-sql.md)

docs/relational-databases/system-views/queryinsights-frequently-run-queries-transact-sql.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "The queryinsights.frequently_run_queries provides information abou
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: mariyaali
7-
ms.date: 10/30/2023
7+
ms.date: 07/17/2024
88
ms.service: sql
99
ms.topic: "reference"
1010
f1_keywords:
@@ -16,7 +16,7 @@ helpviewer_keywords:
1616
- "query insights frequently_run_queries"
1717
dev_langs:
1818
- "TSQL"
19-
monikerRange: "=fabric"
19+
monikerRange: "=fabric"
2020
---
2121
# queryinsights.frequently_run_queries (Transact-SQL)
2222
[!INCLUDE [fabric-se-and-dw](../../includes/applies-to-version/fabric-se-and-dw.md)]
@@ -25,30 +25,31 @@ monikerRange: "=fabric"
2525

2626
| Column name | Data type | Description |
2727
| --- | --- | --- |
28-
| last_run_start_time | datetime2 | Time of the most recent query execution.|
29-
|last_run_command | varchar(8000) | Text of the last query execution.|
30-
| number_of_runs | int | Total number of times the query was executed.|
31-
| avg_total_elapsed_time_ms | int | Average query execution time (ms) across all runs.|
32-
| last_run_total_elapsed_time_ms | int | Time taken by the last execution (ms).|
33-
| last_dist_statement_id | uniqueidentifier | ID linking the query to `queryinsights.exec_requests_history`.|
34-
|last_run_session_id | smallint | User session ID for the last execution.|
35-
| min_run_total_elapsed_time_ms | int |Shortest query execution time (ms).|
36-
|max_run_total_elapsed_time_ms | int |Longest query execution time (ms).|
37-
|number_of_successful_runs | int |Number of successful query executions.|
38-
|number_of_failed_runs |int |Number of failed query executions.|
39-
|number_of_cancelled_runs |int |Number of canceled query executions.|
28+
| `last_run_start_time` | **datetime2** | Time of the most recent query execution.|
29+
| `last_run_command` | **varchar(8000)** | Text of the last query execution.|
30+
| `number_of_runs` | **int** | Total number of times the query was executed.|
31+
| `avg_total_elapsed_time_ms` | **int** | Average query execution time (ms) across all runs.|
32+
| `last_run_total_elapsed_time_ms` | **int** | Time taken by the last execution (ms).|
33+
| `last_dist_statement_id` | **uniqueidentifier** | ID linking the query to `queryinsights.exec_requests_history`.|
34+
| `last_run_session_id` | **smallint** | User session ID for the last execution.|
35+
| `min_run_total_elapsed_time_ms` | **int** |Shortest query execution time (ms).|
36+
| `max_run_total_elapsed_time_ms` | **int** |Longest query execution time (ms).|
37+
| `number_of_successful_runs` | **int** |Number of successful query executions.|
38+
| `number_of_failed_runs` | **int** |Number of failed query executions.|
39+
| `number_of_cancelled_runs` |**int** |Number of canceled query executions.|
4040

4141
## Permissions
4242

4343
You should have access to a [[!INCLUDE [fabric-se](../../includes/fabric-se.md)]](/fabric/data-warehouse/data-warehousing#sql-endpoint-of-the-lakehouse) or [[!INCLUDE [fabric-dw](../../includes/fabric-dw.md)]](/fabric/data-warehouse/data-warehousing#synapse-data-warehouse) within a [Premium capacity](/power-bi/enterprise/service-premium-what-is) workspace with Contributor or above permissions.
4444

45+
## Next step
46+
47+
> [!div class="nextstepaction"]
48+
> [Query insights in Microsoft Fabric](/fabric/data-warehouse/query-insights)
49+
4550
## Related content
4651

4752
- [Monitoring connections, sessions, and requests using DMVs in Microsoft Fabric](/fabric/data-warehouse/monitor-using-dmv)
53+
- [queryinsights.exec_sessions_history (Transact-SQL)](queryinsights-exec-sessions-history-transact-sql.md)
4854
- [queryinsights.long_running_queries (Transact-SQL)](queryinsights-long-running-queries-transact-sql.md)
4955
- [queryinsights.exec_requests_history (Transact-SQL)](queryinsights-exec-requests-history-transact-sql.md)
50-
51-
## Next step
52-
53-
> [!div class="nextstepaction"]
54-
> [Query insights in Microsoft Fabric](/fabric/data-warehouse/query-insights)

docs/relational-databases/system-views/queryinsights-long-running-queries-transact-sql.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "The queryinsights.long_running_queries in Microsoft Fabric provide
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: mariyaali
7-
ms.date: 10/30/2023
7+
ms.date: 07/17/2024
88
ms.service: sql
99
ms.topic: "reference"
1010
f1_keywords:
@@ -16,7 +16,7 @@ helpviewer_keywords:
1616
- "query insights long_running_queries"
1717
dev_langs:
1818
- "TSQL"
19-
monikerRange: "=fabric"
19+
monikerRange: "=fabric"
2020
---
2121
# queryinsights.long_running_queries (Transact-SQL)
2222
[!INCLUDE [fabric-se-and-dw](../../includes/applies-to-version/fabric-se-and-dw.md)]
@@ -25,25 +25,26 @@ monikerRange: "=fabric"
2525

2626
| Column name | Data type | Description |
2727
| --- | --- | --- |
28-
|last_run_start_time | datetime2 | Time of the most recent query execution.|
29-
|last_run_command | varchar(8000) | Text of the last query execution.|
30-
|median_total_elapsed_time_ms | int | Median query execution time (ms) across runs.|
31-
|number_of_runs | int | Total number of times the query was executed.|
32-
|last_run_total_elapsed_time_ms | int | Time taken by the last execution (ms).|
33-
|last_dist_statement_id | uniqueidentifier | ID linking the query to `queryinsights.exec_requests_history`.|
34-
|last_run_session_id | smallint | User session ID for the last execution.|
28+
| `last_run_start_time` | **datetime2** | Time of the most recent query execution.|
29+
| `last_run_command` | **varchar(8000)** | Text of the last query execution.|
30+
| `median_total_elapsed_time_ms` | **int** | Median query execution time (ms) across runs.|
31+
| `number_of_runs` | **int** | Total number of times the query was executed.|
32+
| `last_run_total_elapsed_time_ms` | **int** | Time taken by the last execution (ms).|
33+
| `last_dist_statement_id` | **uniqueidentifier** | ID linking the query to `queryinsights.exec_requests_history`.|
34+
| `last_run_session_id` | **smallint** | User session ID for the last execution.|
3535

3636
## Permissions
3737

3838
You should have access to a [[!INCLUDE [fabric-se](../../includes/fabric-se.md)]](/fabric/data-warehouse/data-warehousing#sql-endpoint-of-the-lakehouse) or [[!INCLUDE [fabric-dw](../../includes/fabric-dw.md)]](/fabric/data-warehouse/data-warehousing#synapse-data-warehouse) within a [Premium capacity](/power-bi/enterprise/service-premium-what-is) workspace with Contributor or above permissions.
3939

40+
## Next step
41+
42+
> [!div class="nextstepaction"]
43+
> [Query insights in Microsoft Fabric](/fabric/data-warehouse/query-insights)
44+
4045
## Related content
4146

4247
- [Monitoring connections, sessions, and requests using DMVs in Microsoft Fabric](/fabric/data-warehouse/monitor-using-dmv)
48+
- [queryinsights.exec_sessions_history (Transact-SQL)](queryinsights-exec-sessions-history-transact-sql.md)
4349
- [queryinsights.exec_requests_history (Transact-SQL)](queryinsights-exec-requests-history-transact-sql.md)
4450
- [queryinsights.frequently_run_queries (Transact-SQL)](queryinsights-frequently-run-queries-transact-sql.md)
45-
46-
## Next step
47-
48-
> [!div class="nextstepaction"]
49-
> [Query insights in Microsoft Fabric](/fabric/data-warehouse/query-insights)

docs/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12444,6 +12444,8 @@ items:
1244412444
items:
1244512445
- name: queryinsights.exec_requests_history
1244612446
href: relational-databases/system-views/queryinsights-exec-requests-history-transact-sql.md
12447+
- name: queryinsights.exec_sessions_history
12448+
href: relational-databases/system-views/queryinsights-exec-sessions-history-transact-sql.md
1244712449
- name: queryinsights.frequently_run_queries
1244812450
href: relational-databases/system-views/queryinsights-frequently-run-queries-transact-sql.md
1244912451
- name: queryinsights.long_running_queries

0 commit comments

Comments
 (0)