You should find that which of wait events are in the SQL Server database.
To solve slowness of SQL Server database, you should find which wait events exists in the database.
You can find wait events of database with following query.
with waits as (select wait_type, wait_time_ms / 1000.0 as waits, (wait_time_ms - signal_wait_time_ms) / 1000.0 as resources, signal_wait_time_ms / 1000.0 as signals, waiting_tasks_count as waitcount, 100.0 * wait_time_ms / sum (wait_time_ms) over() as percentage, row_number() over(order by wait_time_ms desc) as rownum from sys.dm_os_wait_stats where wait_type not in ( N'CLR_SEMAPHORE', N'LAZYWRITER_SLEEP', N'RESOURCE_QUEUE', N'SQLTRACE_BUFFER_FLUSH', N'SLEEP_TASK', N'SLEEP_SYSTEMTASK', N'WAITFOR', N'HADR_FILESTREAM_IOMGR_IOCOMPLETION', N'CHECKPOINT_QUEUE', N'REQUEST_FOR_DEADLOCK_SEARCH', N'XE_TIMER_EVENT', N'XE_DISPATCHER_JOIN', N'LOGMGR_QUEUE', N'FT_IFTS_SCHEDULER_IDLE_WAIT', N'BROKER_TASK_STOP', N'CLR_MANUAL_EVENT', N'CLR_AUTO_EVENT', N'DISPATCHER_QUEUE_SEMAPHORE', N'TRACEWRITE', N'XE_DISPATCHER_WAIT', N'BROKER_TO_FLUSH', N'BROKER_EVENTHANDLER', N'FT_IFTSHC_MUTEX', N'SQLTRACE_INCREMENTAL_FLUSH_SLEEP', N'DIRTY_PAGE_POLL', N'SP_SERVER_DIAGNOSTICS_SLEEP') ) select w1.wait_type as waittype, cast (w1.waits as decimal(14, 2)) wait_s, cast (w1.resources as decimal(14, 2)) resource_s, cast (w1.signals as decimal(14, 2)) signal_s, w1.waitcount wait_count, cast (w1.percentage as decimal(4, 2)) percentage, cast ((w1.waits / w1.waitcount) as decimal (14, 4)) avgWait_s, cast ((w1.resources / w1.waitcount) as decimal (14, 4)) avgResource_s, cast ((w1.signals / w1.waitcount) as decimal (14, 4)) avgSignal_s from waits as w1 inner join waits as w2 on w2.rownum <= w1.rownum group by w1.rownum, w1.wait_type, w1.waits, w1.resources, w1.signals, w1.waitcount, w1.percentage having sum (w2.percentage) - w1.percentage < 95; -- percentage threshold
Do you want to learn Microsoft SQL Server DBA Tutorials for Beginners, then read the following articles.
1,509 views last month, 1 views today