|
| 1 | +--- |
| 2 | +title: Troubleshooting guides - Azure portal - Azure Database for PostgreSQL - Flexible Server Preview |
| 3 | +description: Learn how to use Troubleshooting guides for Azure Database for PostgreSQL - Flexible Server from the Azure portal. |
| 4 | +ms.service: postgresql |
| 5 | +ms.subservice: flexible-server |
| 6 | +ms.topic: how-to |
| 7 | +ms.author: alkuchar |
| 8 | +author: AwdotiaRomanowna |
| 9 | +ms.date: 03/21/2023 |
| 10 | +--- |
| 11 | + |
| 12 | +# Use the Troubleshooting guides for Azure Database for PostgreSQL - Flexible Server Preview |
| 13 | + |
| 14 | +[!INCLUDE [applies-to-postgresql-flexible-server](../includes/applies-to-postgresql-flexible-server.md)] |
| 15 | + |
| 16 | +> [!NOTE] |
| 17 | +> Troubleshooting guides for PostgreSQL Flexible Server are currently in preview. |
| 18 | +
|
| 19 | +In this article, you'll learn how to use Troubleshooting guides for Azure Database for PostgreSQL from the Azure portal. To learn more about Troubleshooting guides, see the [overview](concepts-troubleshooting-guides.md). |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +To effectively troubleshoot specific issue, you need to make sure you have all the necessary data in place. |
| 24 | +Each troubleshooting guide requires a specific set of data, which is sourced from three separate features: [Diagnostic settings](howto-configure-and-access-logs.md), [Query Store](concepts-query-store.md), and [Enhanced Metrics](concepts-monitoring.md#enabling-enhanced-metrics). |
| 25 | +All troubleshooting guides require logs to be sent to the Log Analytics workspace, but the specific category of logs to be captured may vary depending on the particular guide. |
| 26 | + |
| 27 | +Please follow the steps described in the [Configure and Access Logs in Azure Database for PostgreSQL - Flexible Server](howto-configure-and-access-logs.md) article to configure diagnostic settings and send the logs to the Log Analytics workspace. |
| 28 | +Query Store, and Enhanced Metrics are configured via the Server Parameters. Please follow the steps described in the "Configure server parameters in Azure Database for PostgreSQL - Flexible Server" articles for [Azure portal](howto-configure-server-parameters-using-portal.md) or [Azure CLI](howto-configure-server-parameters-using-cli.md). |
| 29 | + |
| 30 | +The table below provides information on the required log categories for each troubleshooting guide, as well as the necessary Query Store, Enhanced Metrics and Server Parameters prerequisites. |
| 31 | + |
| 32 | +| Troubleshooting guide | Diagnostic settings log categories | Query Store | Enhanced Metrics | Server Parameters | |
| 33 | +|:----------------------|:--------------------------------------------------------------------------------------------------------------------|----------------------------------------------|-------------------------------------|-------------------| |
| 34 | +| Autovacuum Blockers | PostgreSQL Sessions, PostgreSQL Database Remaining Transactions | N/A | N/A | N/A | |
| 35 | +| Autovacuum Monitoring | PostgreSQL Server Logs, PostgreSQL Tables Statistics, PostgreSQL Database Remaining Transactions | N/A | N/A | log_autovacuum_min_duration | |
| 36 | +| High CPU Usage | PostgreSQL Server Logs, PostgreSQL Sessions, AllMetrics | pg_qs.query_capture_mode to TOP or ALL | metrics.collector_database_activity | N/A | |
| 37 | +| High IOPS Usage | PostgreSQL Query Store Runtime, PostgreSQL Server Logs, PostgreSQL Sessions, PostgreSQL Query Store Wait Statistics | pgms_wait_sampling.query_capture_mode to ALL | metrics.collector_database_activity | N/A | |
| 38 | +| High Memory Usage | PostgreSQL Server Logs, PostgreSQL Sessions, PostgreSQL Query Store Runtime | pg_qs.query_capture_mode to TOP or ALL | metrics.collector_database_activity | N/A | |
| 39 | +| High Temporary Files | PostgreSQL Sessions, PostgreSQL Query Store Runtime, PostgreSQL Query Store Wait Statistics | pg_qs.query_capture_mode to TOP or ALL | metrics.collector_database_activity | N/A | |
| 40 | + |
| 41 | + |
| 42 | +> [!NOTE] |
| 43 | +> Please note that if you have recently enabled diagnostic settings, query store, enhanced metrics or server parameters, it may take some time for the data to be populated. Additionally, if there has been no activity on the database within a certain time frame, the charts might appear empty. In such cases, try changing the time range to capture relevant data. Be patient and allow the system to collect and display the necessary data before proceeding with your troubleshooting efforts. |
| 44 | +
|
| 45 | +## Using Troubleshooting guides |
| 46 | + |
| 47 | +To use troubleshooting guides, follow these steps: |
| 48 | + |
| 49 | +1. Open the Azure portal and find a Postgres instance that you want to examine. |
| 50 | + |
| 51 | +2. From the left-side menu, open Help > Troubleshooting guides. |
| 52 | + |
| 53 | +3. Navigate to the top of the page where you will find a series of tabs, each representing one of the six problems you may wish to resolve. Click on the relevant tab. |
| 54 | + |
| 55 | + :::image type="content" source="./media/how-to-troubleshooting-guides/portal-blade-overview.png" alt-text="Screenshot of Troubleshooting guides - tabular view."::: |
| 56 | + |
| 57 | +4. Select the time range during which the problem occurred. |
| 58 | + |
| 59 | + :::image type="content" source="./media/how-to-troubleshooting-guides/time-range.png" alt-text="Screenshot of time range picker."::: |
| 60 | + |
| 61 | +5. Follow the step-by-step instructions provided by the guide. Pay close attention to the charts and data visualizations plotted within the troubleshooting steps, as they can help you identify any inaccuracies or anomalies. Use this information to effectively diagnose and resolve the problem at hand. |
| 62 | + |
| 63 | +### Retrieving the Query Text |
| 64 | + |
| 65 | +Due to privacy considerations, certain information such as query text and usernames may not be displayed within the Azure portal. |
| 66 | +To retrieve the query text, you will need to log in to your Azure Database for PostgreSQL - Flexible Server instance. |
| 67 | +Access the `azure_sys` database using the PostgreSQL client of your choice, where query store data is stored. |
| 68 | +Once connected, query the `query_store.query_texts_view view` to retrieve the desired query text. |
| 69 | + |
| 70 | +In the example shown below, we utilize Azure Cloud Shell and the `psql` tool to accomplish this task: |
| 71 | + |
| 72 | +:::image type="content" source="./media/how-to-troubleshooting-guides/retrieve-query-text.png" alt-text="Screenshot of retrieving the Query Text."::: |
| 73 | + |
| 74 | +### Retrieving the Username |
| 75 | + |
| 76 | +For privacy reasons, the Azure portal displays the role ID from the PostgreSQL metadata (pg_catalog) rather than the actual username. |
| 77 | +To retrieve the username, you can query the `pg_roles` view or use the query shown below in your PostgreSQL client of choice, such as Azure Cloud Shell and the `psql` tool: |
| 78 | + |
| 79 | +```sql |
| 80 | +SELECT 'UserID'::regrole; |
| 81 | +``` |
| 82 | + |
| 83 | +:::image type="content" source="./media/how-to-troubleshooting-guides/retrieve-username.png" alt-text="Screenshot of retrieving the Username."::: |
| 84 | + |
| 85 | + |
| 86 | +## Next steps |
| 87 | + |
| 88 | +* Learn more about [Troubleshoot high CPU utilization](how-to-high-cpu-utilization.md). |
| 89 | +* Learn more about [High memory utilization](how-to-high-memory-utilization.md). |
| 90 | +* Learn more about [Troubleshoot high IOPS utilization](how-to-high-io-utilization.md). |
| 91 | +* Learn more about [Autovacuum Tuning](how-to-autovacuum-tuning.md). |
| 92 | + |
| 93 | +[//]: # (* Learn how to [create and manage read replicas in the Azure CLI and REST API](how-to-read-replicas-cli.md).) |
0 commit comments