marcingminski / sqlwatch

SQL Server Performance Monitor
https://docs.sqlwatch.io
Other
428 stars 168 forks source link

Waiting Tasks in SQL Instance Overview is wrong #409

Open funooni opened 3 years ago

funooni commented 3 years ago

In the Dashboard : SQL Instance Overview, the "Waiting" tile is showing wrong values.

The value comes from the table sqlwatch_logger_dm_exec_requests_stats column waiting_tasks.

The problem is due to the sum of duplicate rows in the first query which populates the table sqlwatch_logger_dm_exec_requests_stats. The duplicate rows are because of lack of join on session id. I have changed the source sp "usp_sqlwatch_logger_requests_and_sessions" and it works fine. However, I have not done any smoke testing except the values in this tile.

added the below in selection , t.session_id had to group by group by case when t.session_id > 50 then 1 else 0 end , t.session_id then added the below in join condition on t.type = case when r.session_id > 50 then 1 else 0 end and t.session_id = r.session_id

marcingminski commented 3 years ago

Hi, thank you for this. I will take a look.

marcingminski commented 3 years ago

Are you referring to the query in the dashboard, or the query that collects the data into the table?

funooni commented 3 years ago

Are you referring to the query in the dashboard, or the query that collects the data into the table?

The query that collects the data into the table. Its the first insert inside the procedure "usp_sqlwatch_logger_requests_and_sessions"

I just created a pull request with this change as well.