Use the troubleshooting guides for Azure Database for PostgreSQL - Flexible Server
APPLIES TO: Azure Database for PostgreSQL - Flexible Server
In this article, you learn how to use troubleshooting guides for Azure Database for PostgreSQL flexible server from the Azure portal. To learn more about troubleshooting guides, see the overview.
Prerequisites
To effectively troubleshoot specific issue, you need to make sure you have all the necessary data in place. Each troubleshooting guide requires a specific set of data, which is sourced from three separate features: Diagnostic settings, Query Store, and Enhanced Metrics. 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.
Please follow the steps described in Configure and Access Logs - Azure Database for PostgreSQL - Flexible Server to configure diagnostic settings and send the logs to the Log Analytics workspace. 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 or Azure CLI.
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.
Troubleshooting guide | Diagnostic settings log categories | Query Store | Enhanced Metrics | Server Parameters |
---|---|---|---|---|
Autovacuum Blockers | Azure Database for PostgreSQL flexible server Sessions, Azure Database for PostgreSQL flexible server Database Remaining Transactions | N/A | N/A | N/A |
Autovacuum Monitoring | Azure Database for PostgreSQL flexible server Logs, PostgreSQL Tables Statistics, Azure Database for PostgreSQL flexible server Database Remaining Transactions | N/A | N/A | log_autovacuum_min_duration |
High CPU Usage | Azure Database for PostgreSQL flexible server Logs, Azure Database for PostgreSQL flexible server Sessions, AllMetrics | pg_qs.query_capture_mode to TOP or ALL | metrics.collector_database_activity | N/A |
High IOPS Usage | Azure Database for PostgreSQL flexible server Query Store Runtime, Azure Database for PostgreSQL flexible server Logs, Azure Database for PostgreSQL flexible server Sessions, Azure Database for PostgreSQL flexible server Query Store Wait Statistics | pgms_wait_sampling.query_capture_mode to ALL | metrics.collector_database_activity | track_io_timing to ON |
High Memory Usage | Azure Database for PostgreSQL flexible server Logs, Azure Database for PostgreSQL flexible server Sessions, Azure Database for PostgreSQL flexible server Query Store Runtime | pg_qs.query_capture_mode to TOP or ALL | metrics.collector_database_activity | N/A |
High Temporary Files | Azure Database for PostgreSQL flexible server Sessions, Azure Database for PostgreSQL flexible server Query Store Runtime, Azure Database for PostgreSQL flexible server Query Store Wait Statistics | pg_qs.query_capture_mode to TOP or ALL | metrics.collector_database_activity | N/A |
Note
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.
Using Troubleshooting guides
To use troubleshooting guides, follow these steps:
Open the Azure portal and find an Azure Database for PostgreSQL flexible server instance that you want to examine.
From the left-side menu, open Help > Troubleshooting guides.
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.
Select the time range during which the problem occurred.
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.
Retrieving the Query Text
Due to privacy considerations, certain information such as query text and usernames may not be displayed within the Azure portal.
To retrieve the query text, you need to log in to your Azure Database for PostgreSQL flexible server instance.
Access the azure_sys
database using the PostgreSQL client of your choice, where query store data is stored.
Once connected, query the query_store.query_texts_view view
to retrieve the desired query text.
In the example shown below, we utilize Azure Cloud Shell and the psql
tool to accomplish this task:
Retrieving the Username
For privacy reasons, the Azure portal displays the role ID from the PostgreSQL metadata (pg_catalog) rather than the actual username.
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:
SELECT 'UserID'::regrole;
Next steps
- Learn more about Troubleshoot high CPU utilization.
- Learn more about High memory utilization.
- Learn more about Troubleshoot high IOPS utilization.
- Learn more about Autovacuum Tuning.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for