Create table tempdb.dbo.sys_dm_os_wait_stats
(Run_time datetime, wait_type nvarchar(60), waiting_tasks_count bigint,
wait_time_ms bigint, signal_wait_time_ms bigint)
go
insert into tempdb.dbo.sys_dm_os_wait_stats ( Run_time, wait_type,
waiting_tasks_count, wait_time_ms, signal_wait_time_ms)
select getdate() as 'Run_Time',wait_type,waiting_tasks_count,
wait_time_ms,signal_wait_time_ms
from sys.dm_os_wait_stats
order by wait_time_ms desc
--wait for 1 minute and get the last data and compare it with last saved snapshot
--you can re-run the query for every 1 minute and check any wait_type which is
--being at the top
--check the wait_type and trying to work on it
select getdate() as 'Run_Time', TEMP_WS.Run_time as Snapshot_Time,
WS.wait_type,
WS.wait_time_ms-TEMP_WS.wait_time_ms as "delta_wait_time_ms",
WS.waiting_tasks_count-TEMP_WS.waiting_tasks_count as "delta_waiting_tasks_count",
WS.signal_wait_time_ms-TEMP_WS.signal_wait_time_ms as "delta_signal_wait_time_ms",
(WS.wait_time_ms-TEMP_WS.wait_time_ms)-
(WS.signal_wait_time_ms-TEMP_WS.signal_wait_time_ms)
as "delta_resource_wait_time_ms",
((WS.wait_time_ms-TEMP_WS.wait_time_ms)-
(WS.signal_wait_time_ms-TEMP_WS.signal_wait_time_ms))/
(WS.waiting_tasks_count-TEMP_WS.waiting_tasks_count)
as "delta_avg_resource_wait_time_ms"
from sys.dm_os_wait_stats WS
left outer join tempdb.dbo.sys_dm_os_wait_stats TEMP_WS
on WS.wait_type=TEMP_WS.wait_type
where WS.wait_type not in ('BROKER_TASK_STOP','Total','SLEEP','BROKER_EVENTHANDLER',
'BROKER_RECEIVE_WAITFOR', 'BROKER_TRANSMITTER','CHECKPOINT_QUEUE',
'CHKPT','CLR_AUTO_EVENT','CLR_MANUAL_EVENT','KSOURCE_WAKEUP','LAZYWRITER_SLEEP',
'LOGMGR_QUEUE','ONDEMAND_TASK_QUEUE','REQUEST_FOR_DEADLOCK_SEARCH','RESOURCE_QUEUE',
'SERVER_IDLE_CHECK', 'SLEEP_BPOOL_FLUSH','SLEEP_DBSTARTUP','SLEEP_DCOMSTARTUP',
'SLEEP_MSDBSTARTUP','SLEEP_SYSTEMTASK','SLEEP_TASK', 'SLEEP_TEMPDBSTARTUP',
'SNI_HTTP_ACCEPT','SQLTRACE_BUFFER_FLUSH','TRACEWRITE','WAIT_FOR_RESULTS',
'WAITFOR_TASKSHUTDOWN', 'XE_DISPATCHER_WAIT','XE_TIMER_EVENT','WAITFOR',
'CLR_SEMAPHORE', 'BROKER_TO_FLUSH', 'DISPATCHER_QUEUE_SEMAPHORE',
'FT_IFTS_SCHEDULER_IDLE_WAIT', 'FT_IFTSHC_MUTEX', 'XE_DISPATCHER_JOIN',
'SQLTRACE_INCREMENTAL_FLUSH_SLEEP')
and (WS.wait_time_ms-TEMP_WS.wait_time_ms) > 0
order by "delta_wait_time_ms" desc
--if you want you can truncate the table and re-run the query
truncate table tempdb.dbo.sys_dm_os_wait_stats
--at the end you can drop the table
drop table tempdb.dbo.sys_dm_os_wait_stats