Query Performance InsightQuery Performance Insight

适用于: Azure Database for PostgreSQL - 单一服务器版本 9.6、10、11Applies to: Azure Database for PostgreSQL - Single Server versions 9.6, 10, 11

Query Performance Insight 可帮助你快速确定运行时间最长的查询、它们如何随时间的推移而变化,以及哪些等待因素会影响它们。Query Performance Insight helps you to quickly identify what your longest running queries are, how they change over time, and what waits are affecting them.

权限Permissions

查看 Query Performance Insight 中查询文本所需的“所有者” 或“参与者” 权限。Owner or Contributor permissions required to view the text of the queries in Query Performance Insight. 读者 可以查看图表和表格,但不能查看查询文本。Reader can view charts and tables but not query text.

先决条件Prerequisites

若要运行 Query Performance Insight,数据必须存在于查询存储中。For Query Performance Insight to function, data must exist in the Query Store.

查看性能见解Viewing performance insights

Azure 门户中的 Query Performance Insight 视图将显示来自查询存储的关键信息的可视化效果。The Query Performance Insight view in the Azure portal will surface visualizations on key information from Query Store.

在 Azure Database for PostgreSQL 服务器的门户页中,选择菜单栏的“智能性能” 部分下的“Query Performance Insight” 。In the portal page of your Azure Database for PostgreSQL server, select Query performance Insight under the Intelligent Performance section of the menu bar.

Query Performance Insight 长时间运行的查询

“长时间运行的查询” 选项卡按每次执行平均持续时间显示前 5 个查询,每隔 15 分钟聚合一次。The Long running queries tab shows the top five queries by average duration per execution, aggregated in 15-minute intervals. 可以通过从“查询数量” 下拉列表中进行选择来查看更多查询。You can view more queries by selecting from the Number of Queries drop down. 执行此操作时,特定查询 ID 的图表颜色可能会更改。The chart colors may change for a specific Query ID when you do this.

可以在图表中单击并拖动以缩小到特定的时间窗口。You can click and drag in the chart to narrow down to a specific time window. 或者,使用放大和缩小图标分别查看更短或更长的时间段。Alternatively, use the zoom in and out icons to view a smaller or larger period of time respectively.

图表下方的表提供了有关该时间窗口中长时间运行的查询的更多详细信息。The table below the chart gives more details about the long-running queries in that time window.

选择“等待统计信息” 选项卡以查看服务器中等待次数的相应可视化效果。Select the Wait Statistics tab to view the corresponding visualizations on waits in the server.

Query Performance Insight 等待统计信息

注意事项Considerations

后续步骤Next steps