Skip to content

Commit 711ce08

Browse files
authored
Merge pull request #233254 from varun-dhawan/varund-novena
[PostgreSQL] adds the page for query performance insight
2 parents 66c82a9 + a2518f7 commit 711ce08

File tree

5 files changed

+83
-0
lines changed

5 files changed

+83
-0
lines changed

articles/postgresql/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@
534534
href: flexible-server/concepts-query-store-best-practices.md
535535
- name: Intelligent tuning
536536
href: flexible-server/concepts-intelligent-tuning.md
537+
- name: Query Performance Insight
538+
href: flexible-server/concepts-query-performance-insight.md
537539
- name: Replication
538540
items:
539541
- name: Read replicas
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: Query Performance Insight - Azure Database for PostgreSQL - Flexible server
3+
description: This article describes the Query Performance Insight feature in Azure Database for PostgreSQL - Flexible server.
4+
ms.service: postgresql
5+
ms.subservice: flexible-server
6+
ms.topic: conceptual
7+
author: varun-dhawan
8+
ms.author: varundhawan
9+
ms.date: 4/1/2023
10+
---
11+
12+
# Query Performance Insight (Preview)
13+
14+
[!INCLUDE [applies-to-postgresql-flexible-server](../includes/applies-to-postgresql-flexible-server.md)]
15+
16+
Query Performance Insight provides intelligent query analysis for Azure Postgres Flexible server databases. It helps identify the top resource consuming and long-running queries in your workload. This helps you find the queries to optimize to improve overall workload performance and efficiently use the resource that you are paying for. Query Performance Insight helps you spend less time troubleshooting database performance by providing:
17+
18+
>[!div class="checklist"]
19+
> * Identify what your long running queries, and how they change over time.
20+
> * Determine the wait types affecting those queries.
21+
> * Details on top database queries by Calls (execution count ), by data-usage, by IOPS and by Temporary file usage (potential tuning candidates for performance improvements).
22+
> * The ability to drill down into details of a query, to view the Query ID and history of resource utilization.
23+
> * Deeper insight into overall databases resource consumption.
24+
25+
## Prerequisites
26+
27+
1. **[Query Store](concepts-query-store.md)** is enabled on your database. If Query Store is not running, the Azure portal will prompt you to enable it. To enable Query Store, refer [here](concepts-query-store.md#enable-query-store)
28+
29+
> [!NOTE]
30+
> **Query Store** is currently **disabled**. This troubleshooting guide depends on Query Store data. You need to enable it by setting the dynamic server parameter `pg_qs.query_capture_mode` to either **ALL** or **TOP**.
31+
32+
2. **[Query Store Wait Sampling](concepts-query-store.md)** is enabled on your database. If Query Store Wait Sampling is not running, the Azure portal will prompt you to enable it. To enable Query Store Wait Sampling, refer [here](concepts-query-store.md#enable-query-store-wait-sampling)
33+
34+
> [!NOTE]
35+
> **Query Store Wait Sampling** is currently **disabled**. This troubleshooting guide depends on Query Store wait sampling data. You need to enable it by setting the dynamic server parameter `pgms_wait_sampling.query_capture_mode` to **ALL**.
36+
37+
3. **[Log analytics workspace](howto-configure-and-access-logs.md)** is configured for storing 3 log categories including - PostgreSQL Sessions logs, PostgreSQL Query Store and Runtime and PostgreSQL Query Store Wait Statistics. To configure log analytics, refer [Log analytics workspace](howto-configure-and-access-logs.md#configure-diagnostic-settings)
38+
39+
> [!NOTE]
40+
> The **Query Store data is not being transmitted to the log analytics workspace**. The PostgreSQL logs (Sessions data / Query Store Runtime / Query Store Wait Statistics) is not being sent to the log analytics workspace, which is necessary to use Query Performance Insight . To configure the logging settings for category PostgreSQL sessions and send the data to a log analytics workspace.
41+
42+
## Using Query Performance Insight
43+
44+
The [Query Performance Insight](concepts-query-performance-insight.md) view in the Azure portal will surface visualizations on key information from Query Store. Query Performance Insight is easy to use:
45+
46+
1. Open the Azure portal and find a postgres instance that you want to examine.
47+
2. From the left-side menu, open **Intelligent Performance** > **Query Performance Insight**
48+
3. Select a **time range** for investigating queries.
49+
4. On the first tab, review the list of **Long Running Queries**.
50+
5. Use sliders or zoom to change the observed interval.
51+
:::image type="content" source="./media/concepts-query-performance-insight/1-long-running-queries.png" alt-text="Screenshot of using sliders to change the observed interval.":::
52+
53+
6. Optionally, you can select the **custom** to specify a time range.
54+
55+
> [!NOTE]
56+
> For Azure PostgreSQL Flexible Server to render the information in Query Performance Insight, **Query Store needs to capture a couple hours of data**. If the database has no activity or if Query Store was not active during a certain period, the charts will be empty when Query Performance Insight displays that time range. You can enable Query Store at any time if it's not running. For more information, see [Best practices with Query Store](concepts-query-store-best-practices.md)
57+
58+
7. To **view details** of a specific query, click the `QueryId Snapshot` dropdown.
59+
:::image type="content" source="./media/concepts-query-performance-insight/2-individual-query-details.png" alt-text="Screenshot of viewing details of a specific query.":::
60+
61+
8. To get the **Query Text** of a specific query, connect to the `azure_sys` database on the server and query `query_store.query_texts_view` with the `QueryId`
62+
:::image type="content" source="./media/concepts-query-performance-insight/3-view-query-text.png" alt-text="Screenshot of getting query text of a specific query.":::
63+
64+
9. On the Consecutive tabs, you can find other query insights including:
65+
>[!div class="checklist"]
66+
> * Wait Statistics
67+
> * Top Queries by Calls
68+
> * Top Queries by Data-Usage
69+
> * Top Queries by IOPS
70+
> * Top Queries by Temporary Files
71+
72+
## Considerations
73+
74+
* Query Performance Insight is not available for [read replicas](concepts-read-replicas.md)
75+
* For Query Performance Insight to function, data must exist in the Query Store. Query Store is an opt-in feature, so it isn't enabled by default on a server. Query store is enabled or disabled globally for all databases on a given server and cannot be turned on or off per database.
76+
* Enabling Query Store on the Burstable pricing tier may negatively impact performance; therefore, it is not recommended.
77+
78+
79+
## Next steps
80+
81+
- Learn more about [monitoring and tuning](concepts-monitoring.md) in Azure Database for PostgreSQL.
203 KB
Loading
159 KB
Loading
166 KB
Loading

0 commit comments

Comments
 (0)