You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Historical Query Storage and Analysis in Azure Synapse Analytics
3
-
description: Historic query analysis is one of the crucial needs of data engineers. Azure Synapse Analytics provides four main ways to analyze query history and performance. These include DMVs, Azure Data Explorer, Azure Log Analytics and Query Store.
4
-
This article will show you how to use each of these options for your needs.
5
-
2
+
title: Historical query storage and analysis in Azure Synapse Analytics
3
+
description: Historic query analysis is one of the crucial needs of data engineers. Azure Synapse Analytics provides four main ways to analyze query history and performance. These include Query Store, DMVs, Azure Log Analytics, and Azure Data Explorer.
6
4
author: mariyaali
7
5
ms.author: mariyaali
6
+
ms.reviewer: wiassaf
8
7
ms.service: synapse-analytics
9
8
ms.topic: conceptual
10
-
ms.date: 10/12/2021
9
+
ms.date: 10/28/2021
11
10
ms.custom: template-concept
12
11
---
13
12
14
-
# Historical Query Storage and Analysis in Azure Synapse Analytics
13
+
# Historical query storage and analysis in Azure Synapse Analytics
15
14
16
-
Historic query analysis is one of the crucial needs of data engineers. Azure Synapse Analytics provides four main ways to analyze query history and performance. These include DMVs, Azure Data Explorer, Azure Log Analytics and Query Store.
17
-
This article will show you how to use each of these options for your needs.
15
+
Historic query analysis is one of the crucial needs of data engineers. Azure Synapse Analytics provides four main ways to analyze query history and performance. These include Query Store, DMVs, Azure Log Analytics, and Azure Data Explorer.
18
16
19
-
## Introduction
20
-
Historic query analysis is one of the crucial needs of data engineers. Azure Synapse Analytics provides four main ways to analyze query history and performance. These include DMVs, Azure Data Explorer, Azure Log Analytics and Query Store.
17
+
This article will show you how to use each of these options for your needs. Review use cases when it comes to analyzing query history, and the best method for each.
21
18
22
-
This article will show you how to use each of these options for your needs.
19
+
| Customer need | Query Store | DMVs | Log Analytics | Azure Data Explorer |
Use SQL for analysis | :heavy_check_mark: | :heavy_check_mark:| KQL needed | SQL support is limited
29
+
The Query Store feature provides insight on query plan choice and performance. It simplifies performance troubleshooting by helping you quickly find performance differences caused by query plan changes.
33
30
34
-
## Ways to store and analyze query data
35
-
36
-
### Query Store
37
-
38
-
Query Store feature provides insight on query plan choice and performance. It simplifies performance troubleshooting by helping you quickly find performance differences caused by query plan changes. Query Store can hold data for until 30 days in.
39
-
40
-
Query Store is not enabled by default for new Azure Synapse Analytics databases.
41
-
42
-
To enable Query Store to run the following T-SQL command:
31
+
Query Store is not enabled by default for new Azure Synapse Analytics databases. To enable Query Store to run the following T-SQL command:
43
32
44
33
```sql
45
34
ALTERDATABASE<database_name>
46
35
SET QUERY_STORE =ON;
47
36
```
48
37
49
-
You can run performance auditing and troubleshooting related tasks by finding last executed queries, execution counts, longest running queries, queries with maximum physical I/O leads. Please refer to [Monitoring Performance By Using the Query Store](/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store.md) for sample queries.
38
+
You can run performance auditing and troubleshooting related tasks by finding last executed queries, execution counts, longest running queries, queries with maximum physical I/O leads. Please refer to [Monitoring Performance By Using the Query Store](/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store#performance) for sample queries.
50
39
51
40
Advantages:
52
41
* 30 days of threshold for storage query data.
53
-
* Data can be consumed in the same tool that you’d run the query in.
42
+
* Data can be consumed in the same tool that you'd run the query in.
54
43
55
44
Disadvantages:
56
45
* Scenarios for analysis are limited in Query Store for Azure Synapse when compared to using DMVs.
57
46
58
-
### DMV
47
+
## DMVs
48
+
59
49
Dynamic Management Views (DMVs) are extremely useful when it comes to gathering information on query wait times, execution plans, memory, etc.
60
50
It is highly recommended to label your query of interest to track it down later.
61
51
62
52
```sql
63
53
-- Query with Label
64
54
SELECT*
65
55
FROMsys.tables
66
-
OPTION (LABEL ='My Query')
67
-
;
56
+
OPTION (LABEL ='My Query');
68
57
```
69
-
Find more about how to use DMVs here: Monitor your dedicated SQL pool workload using DMVs.
70
-
Documentation on supported views is available here:
For more information on using DMVs to monitor your Azure Synapse Analytics workload, see [Monitor your dedicated SQL pool workload using DMVs](../sql-data-warehouse/sql-data-warehouse-manage-monitor.md?context=/azure/synapse-analytics/context/context). For documentation on catalog views specific to Azure Synapse Analytics, see [Azure Synapse Analytics Catalog Views](/sql/relational-databases/system-catalog-views/sql-data-warehouse-and-parallel-data-warehouse-catalog-views).
89
60
90
61
Advantages:
91
62
* Data can be consumed in the same querying tool.
@@ -95,13 +66,12 @@ Disadvantages:
95
66
* DMVs are limited to 10,000 rows of historic entries.
96
67
* Views are reset when pool is paused/resumed.
97
68
98
-
###Log Analytics
99
-
Log Analytics workspaces can be created easily in the Azure portal. For further instructions on how to connect Synapse with Log Analytics, see [Monitor workload - Azure portal](sql-data-warehouse-monitor-workload-portal.md).
69
+
## Log Analytics
70
+
Log Analytics workspaces can be created easily in the Azure portal. For further instructions on how to connect Synapse with Log Analytics, see [Monitor workload - Azure portal](../sql-data-warehouse/sql-data-warehouse-monitor-workload-portal.md).
100
71
101
-
Like Azure Data Explorer, Log Analytics uses the Kusto Query Language (KQL). For more information about Kusto syntax, see Kusto query overview.
72
+
Like Azure Data Explorer, Log Analytics uses the Kusto Query Language (KQL). For more information about Kusto syntax, see [Kusto query overview](/data-explorer/kusto/query/index.md).
102
73
103
-
Along with configurable retention period, you choose the workspace you are specifically targeting to query in Log Analytics.
104
-
Log Analytics give you the flexibility to store data, run, and save queries.
74
+
Along with configurable retention period, you choose the workspace you are specifically targeting to query in Log Analytics. Log Analytics gives you the flexibility to store data, run, and save queries.
105
75
106
76
Advantages:
107
77
* Azure Log Analytics has a customizable log retention policy
@@ -110,12 +80,21 @@ Disadvantages:
110
80
* Using KQL adds to the learning curve.
111
81
* Limited views can be logged out of the box.
112
82
113
-
### Data Explorer
114
-
Azure Data Explorer (ADX) is a leading data exploration service. This service can be used to analyze historic queries from Azure Synapse Analytics. To setup an Azure Data Factory (ADF) pipeline to copy and store logs to ADX, see [Copy data to or from Azure Data Explorer](/data-factory/connector-azure-data-explorer.md). In ADX, you can run performant Kusto query to analyze your logs. You can combine other strategies here, for example to query and load DMV output to ADX via ADF.
83
+
## Azure Data Explorer (ADX)
84
+
85
+
Azure Data Explorer (ADX) is a leading data exploration service. This service can be used to analyze historic queries from Azure Synapse Analytics. To setup an Azure Data Factory (ADF) pipeline to copy and store logs to ADX, see [Copy data to or from Azure Data Explorer](/data-factory/connector-azure-data-explorer.md). In ADX, you can run performant Kusto query to analyze your logs. You can combine other strategies here, for example to query and load DMV output to ADX via ADF.
115
86
116
87
Advantages:
117
88
* ADX provides a customizable log retention policy.
118
89
* Performant query execution against large amount of data, especially queries involving string search.
119
90
120
91
Disadvantage:
121
-
* Using KQL adds to the learning curve.
92
+
* Using KQL adds to the learning curve.
93
+
94
+
## Next steps
95
+
96
+
-[Azure Data Explorer](/azure/data-explorer/)
97
+
-[Azure Data Factory](/azure/data-factory/)
98
+
-[Log Analytics in Azure Monitor](/azure/azure-monitor/logs/log-analytics-overview)
0 commit comments