microsoft/SqlNexus

Disk IO Analysis Rule is creating false warnings for single spike

hacitandogan opened this issue · 1 comments

image

Checking the [dbo].[usp_IOAnalysis] this is due to following portion of the code where we are checking for average to be bigger than threshold for ~1 minute of interval but since there is only one row above the threshold it is returning that peak moment as average as well;

SELECT @prolonged_avg_sec_transfer = AVG(counterValue), @drive = InstanceName
FROM #tmp
WHERE CounterDateTime BETWEEN (@T_CounterDateTime - '00:00:30') AND (@T_CounterDateTime + '00:00:30')
GROUP BY ObjectName, CounterName, InstanceName
HAVING AVG(counterValue) >= @IO_threshold

image

image

I believe this will be more solid if we make sure there are at least more than 1 rows to calculate the average ;

SELECT @prolonged_avg_sec_transfer = AVG(counterValue), @drive = InstanceName
FROM #tmp
WHERE CounterDateTime BETWEEN (@T_CounterDateTime - '00:00:30') AND (@T_CounterDateTime + '00:00:30')
GROUP BY ObjectName, CounterName, InstanceName
HAVING AVG(counterValue) >= @IO_threshold AND COUNT(1) >1

PR committed and this is fixed.