query the list of factor on performance impact

with waits as
(
 select wait_type,
 wait_time_ms / 1000 as wait_time_s,
 100. * wait_time_ms / SUM(wait_time_ms) over() as pct,
 ROW_NUMBER() over(order by wait_time_ms desc) as rn
 from sys.dm_os_wait_stats
 where wait_type not like '%sleep%'
)
select w1.wait_type,
CAST(w1.wait_time_s as decimal(12,2)) as wait_time_s,
cast(w1.pct as decimal(12,2)) as pct,-- w2.pct,w1.rn, w2.rn
cast(sum(w2.pct) as decimal(12,2)) as running_pct
from waits w1 join waits w2
on w1.rn <= w2.rn
group by w1.rn, w1.wait_type, w1.wait_time_s, w1.pct
having SUM(w2.pct) - w1.pct < 90
order by w1.rn

你可能感兴趣的:(performance)