Lesson Learned #262: Database Wait Stats and Log Analytics.
Published Dec 28 2022 07:11 AM 2,420 Views

Yesterday, we received a question from our customer that needs to know if it is possible to receive an email or alert about the main database wait stats usage for performance monitoring. Following, I would like to share an example how to do it. 


Once we have enabled in our database the option of diagnostics setting to capture the database wait statistics this information will be saved in a specific table AutoDiagnostics in the Category DatabaseWaitStatistics. 


Basically, we need to filter by the resource that we want to monitor and add some logic to calculate the delta. 



| where Category == "DatabaseWaitStatistics"
| where TimeGenerated >= ago(10m)
| project delta_wait_time_ms_d, wait_type_s
| summarize total_wait_time_in_ms = sum(delta_wait_time_ms_d) / 1000
    by wait_type_s
| sort by total_wait_time_in_ms desc
| extend Rank=row_rank(total_wait_time_in_ms)



Once we run this query we have:




With this Kusto Query already implemented, basically, we could create an alert using the button New alert rule:




and configure the alert and the details needed:






Version history
Last update:
‎Dec 28 2022 07:11 AM
Updated by: