Skip to content

Commit d334c45

Browse files
Merge pull request #259844 from markingmyname/stats
[Repo stats] Fix absolute links and metadata
2 parents 0537117 + 5ae5203 commit d334c45

15 files changed

+350
-341
lines changed

articles/dms/known-issues-azure-sql-migration-azure-data-studio.md

Lines changed: 106 additions & 126 deletions
Large diffs are not rendered by default.

articles/postgresql/flexible-server/concepts-query-store-best-practices.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Query Store best practices in Azure Database for PostgreSQL - Flex Server
33
description: This article describes best practices for Query Store in Azure Database for PostgreSQL - Flex Server.
4-
author: ssen-msft
5-
ms.author: ssen
4+
author: markingmyname
5+
ms.author: maghan
66
ms.service: postgresql
77
ms.subservice: flexible-server
88
ms.topic: conceptual
@@ -18,22 +18,25 @@ ms.date: 7/1/2023
1818
This article outlines best practices for using Query Store in Azure Database for PostgreSQL.
1919

2020
## Set the optimal query capture mode
21+
2122
Let Query Store capture the data that matters to you.
2223

2324
|**pg_qs.query_capture_mode** | **Scenario**|
2425
|---|---|
2526
|_All_ |Analyze your workload thoroughly in terms of all queries and their execution frequencies and other statistics. Identify new queries in your workload. Detect if ad hoc queries are used to identify opportunities for user or auto parameterization. _All_ comes with an increased resource consumption cost. |
26-
|_Top_ |Focus your attention on top queries - those issued by clients.
27-
|_None_ |If set to None, Query Store will not capture any new queries. You've already captured a query set and time window that you want to investigate and you want to eliminate the distractions that other queries may introduce. _None_ is suitable for testing and bench-marking environments. _None_ should be used with caution as you might miss the opportunity to track and optimize important new queries. |
27+
|_Top_ |Focus your attention on top queries - those issued by clients.
28+
|_None_ |If set to None, Query Store won't capture any new queries. You've already captured a query set and time window that you want to investigate and you want to eliminate the distractions that other queries may introduce. _None_ is suitable for testing and bench-marking environments. _None_ should be used with caution as you might miss the opportunity to track and optimize important new queries. |
2829

2930

3031
> [!NOTE]
3132
> **pg_qs.query_capture_mode** supersedes **pgms_wait_sampling.query_capture_mode**. If pg_qs.query_capture_mode is _none_, the pgms_wait_sampling.query_capture_mode setting has no effect.
3233
3334

3435
## Keep the data you need
35-
The **pg_qs.retention_period_in_days** parameter specifies in days the data retention period for Query Store. Older query and statistics data is deleted. By default, Query Store is configured to retain the data for 7 days. Avoid keeping historical data you do not plan to use. Increase the value if you need to keep data longer.
36+
37+
The **pg_qs.retention_period_in_days** parameter specifies in days the data retention period for Query Store. Older query and statistics data is deleted. By default, Query Store is configured to retain the data for seven days. Avoid keeping historical data you don't plan to use. Increase the value if you need to keep data longer.
3638

3739

3840
## Next steps
41+
3942
- Learn how to get or set parameters using the [Azure portal](howto-configure-server-parameters-using-portal.md) or the [Azure CLI](howto-configure-server-parameters-using-cli.md).
Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,63 @@
11
---
22
title: Query Store scenarios - Azure Database for PostgreSQL - Flex Server
33
description: This article describes some scenarios for Query Store in Azure Database for PostgreSQL - Flex Server.
4-
author: ssen-msft
5-
ms.author: ssen
4+
author: markingmyname
5+
ms.author: maghan
6+
ms.date: 11/30/2023
67
ms.service: postgresql
78
ms.subservice: flexible-server
89
ms.topic: conceptual
9-
ms.date: 7/1/2023
1010
---
11+
1112
# Usage scenarios for Query Store - Flexible Server
1213

1314
[!INCLUDE [applies-to-postgresql-flexible-server](../includes/applies-to-postgresql-flexible-server.md)]
1415

15-
You can use Query Store in a wide variety of scenarios in which tracking and maintaining predictable workload performance is critical. Consider the following examples:
16-
- Identifying and tuning top expensive queries
17-
- A/B testing
18-
- Keeping performance stable during upgrades
19-
- Identifying and improving ad hoc workloads
16+
You can use Query Store in a wide variety of scenarios in which tracking and maintaining predictable workload performance is critical. Consider the following examples:
17+
- Identifying and tuning top expensive queries
18+
- A/B testing
19+
- Keeping performance stable during upgrades
20+
- Identifying and improving improvised workloads
21+
22+
## Identify and tune expensive queries
23+
24+
### Identify longest running queries
2025

21-
## Identify and tune expensive queries
26+
Use Query Store views on the azure_sys database of your server to quickly identify the longest running queries. These queries typically tend to consume the most resources. Optimizing your longest running queries can improve performance by freeing up resources used by other queries running on your system.
2227

23-
### Identify longest running queries
24-
Use Query Store views on the azure_sys database of your server to quickly identify the longest running queries. These queries typically tend to consume the most resources. Optimizing your longest running queries can improve performance by freeing up resources used by other queries running on your system.
28+
### Target queries with performance deltas
2529

26-
### Target queries with performance deltas
2730
Query Store slices the performance data into time windows, so you can track a query's performance over time. This helps you identify exactly which queries are contributing to an increase in overall time spent. As a result you can do targeted troubleshooting of your workload.
2831

29-
### Tuning expensive queries
30-
When you identify a query with suboptimal performance, the action you take depends on the nature of the problem:
32+
### Tune expensive queries
33+
34+
When you identify a query with suboptimal performance, the action you take depends on the nature of the problem:
3135
- Make sure that the statistics are up-to-date for the underlying tables used by the query.
32-
- Consider rewriting expensive queries. For example, take advantage of query parameterization and reduce the use of dynamic SQL. Implement optimal logic when reading data like applying data filtering on database side, not on application side.
33-
34-
35-
## A/B testing
36-
Use Query Store to compare workload performance before and after an application change you plan to introduce or before and after migration. Example scenarios for using Query Store to assess the impact of changes to workload performance:
37-
- Migration between PostgreSQL versions.
38-
- Rolling out a new version of an application.
39-
- Adding additional resources to the server.
40-
- Creating missing indexes on tables referenced by expensive queries.
41-
- Migration from Single Server to Flex Server.
42-
43-
In any of these scenarios, apply the following workflow:
44-
1. Run your workload with Query Store before the planned change to generate a performance baseline.
45-
2. Apply application change(s) at the controlled moment in time.
46-
3. Continue running the workload long enough to generate performance image of the system after the change.
47-
4. Compare results from before and after the change.
48-
5. Decide whether to keep the change or rollback.
49-
50-
51-
## Identify and improve ad hoc workloads
52-
Some workloads do not have dominant queries that you can tune to improve overall application performance. Those workloads are typically characterized with a relatively large number of unique queries, each of them consuming a portion of system resources. Each unique query is executed infrequently, so individually their runtime consumption is not critical. On the other hand, given that the application is generating new queries all the time, a significant portion of system resources is spent on query compilation, which is not optimal. Usually, this situation happens if your application generates queries (instead of using stored procedures or parameterized queries) or if it relies on object-relational mapping frameworks that generate queries by default.
53-
54-
If you are in control of the application code, you may consider rewriting the data access layer to use stored procedures or parameterized queries. However, this situation can be also be improved without application changes by forcing query parameterization for the entire database (all queries) or for the individual query templates with the same query hash.
55-
56-
## Next steps
57-
- Learn more about the [best practices for using Query Store](concepts-query-store-best-practices.md)
36+
- Consider rewriting expensive queries. For example, take advantage of query parameterization and reduce the use of dynamic SQL. Implement optimal logic when reading data like applying data filtering on database side, not on application side.
37+
38+
## A/B testing
39+
40+
Use Query Store to compare workload performance before and after an application change you plan to introduce or before and after migration. Example scenarios for using Query Store to assess the impact of changes to workload performance:
41+
- Migration between PostgreSQL versions.
42+
- Rolling out a new version of an application.
43+
- Adding additional resources to the server.
44+
- Creating missing indexes on tables referenced by expensive queries.
45+
- Migration from Single Server to Flex Server.
46+
47+
In any of these scenarios, apply the following workflow:
48+
1. Run your workload with Query Store before the planned change to generate a performance baseline.
49+
1. Apply application change(s) at the controlled moment in time.
50+
1. Continue running the workload long enough to generate performance image of the system after the change.
51+
1. Compare results from before and after the change.
52+
1. Decide whether to keep the change or rollback.
53+
54+
## Identify and improve improvised workloads
55+
56+
Some workloads don't have dominant queries that you can tune to improve overall application performance. Those workloads are typically characterized with a relatively large number of unique queries, each of them consuming a portion of system resources. Each unique query is executed infrequently, so individually their runtime consumption isn't critical. On the other hand, given that the application is generating new queries all the time, a significant portion of system resources is spent on query compilation, which isn't optimal. Usually, this situation happens if your application generates queries (instead of using stored procedures or parameterized queries) or if it relies on object-relational mapping frameworks that generate queries by default.
57+
58+
If you are in control of the application code, you might consider rewriting the data access layer to use stored procedures or parameterized queries. However, this situation can be also be improved without application changes by forcing query parameterization for the entire database (all queries) or for the individual query templates with the same query hash.
59+
60+
## Next step
61+
62+
> [!div class="nextstepaction"]
63+
> [best practices for using Query Store](concepts-query-store-best-practices.md)

0 commit comments

Comments
 (0)