次の方法で共有

PGSQLQueryStoreWaits 表的查询

有关在 Azure 门户中使用这些查询的信息,请参阅 Log Analytics 教程。 有关 REST API,请参阅查询

显示所有查询随时间推移的等待事件趋势。

// By default, entries are aggregated in QueryStore Wait Sampling every 15 mins (see pg_qs.interval_length_minutes)
// AgregationWindow was set to 15min, but you may modify it based on your needs, however should not be less than pg_qs.interval_length_minutes. 
let AgregationWindow=15m;
PGSQLQueryStoreWaits
| where UserId !in (10,0) //excludes azure managed user and system calls
| where QueryId != 0  //excludes system calls, background workers and idle sessions
| project StartTime,EndTime, UserId, DatabaseId, QueryId, Calls, EventType, Event
| extend WaitEvent = iff(isempty(EventType), 'No Waits', strcat(EventType, ": ", Event))
| summarize sum(Calls) by WaitEvent, bin(EndTime,AgregationWindow)
| render columnchart

排名靠前的等待事件

按查询确定前 10 个等待事件。

// By default, entries are aggregated in QueryStore Wait Sampling every 15 mins (see pg_qs.interval_length_minutes)
// AgregationWindow was set to 15min, but you may modify it based on your needs, however should not be less than pg_qs.interval_length_minutes. 
let AgregationWindow=15m;
PGSQLQueryStoreWaits
| where UserId !in (10,0) //excludes azure managed user and system calls
| where QueryId != 0 // excludes system calls, background workers and idle sessions
| summarize sumSampledCalls=sum(Calls) by EventType, Event, QueryId, bin(EndTime,AgregationWindow)
| extend WaitEvent = iff(isempty(EventType), 'No Waits', strcat(EventType, ": ", Event))
| top 10 by sumSampledCalls desc