©2011 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without
notice
SQL Server 2008 WAITS
Miroslav Dimitrov
How SQL Server works ?!
• SQL Server OS
– Schedulers
– Workers
Lists to which workers can be assigned:
worker
waiter
runnable
I/O
timer
WAITS – What are they ?!
• SQL Server 2000
– DBCC SQLPERF
– ”sysprocesses” system view (waittype column)
• SQL Server 2005 - DMVs
– sys.dm_os_wait_stats – wait statistics
– sys.dm_os_waiting_tasks – task-level wait information
• SQL Server 2008
– new waits
– Solve the problem with fine-grained analysis of wait statistics in SQL Server 2005
Types of WAITS
• Resource waits
• Queue waits
• External waits
A SQL Server worker thread is not considered to be waiting if any of the
following is true:
• A resource becomes available.
• A queue is nonempty.
• An external process finishes.
Waits
• Memory Waits
– CMEMTHREAD
– RESOURCE_SEMAPHORE
• Disk I/O Waits
– IO_COMPLETION
– ASYNC_IO_COMPLETION
– WRITELOG
– PAGEIOLATCH_*
• Blocking waits
– LCK_*
Waits (continued)
• CPU
– CXPACKET
– SOS_SCHEDULER_YIELD
• Network Waits
– ASYNC_NETWORK_IO
– DBMIRROR_SEND
• System waits
– LAZYWRITER_SLEEP
– REQUEST_FOR_DEADLOCK_SEARCH
– SQLTRACE_BUFFER_FLUSH
– XE_TIMER_EVENT
– FT_IFTS_SCHEDULER_IDLE_WAIT
– LOGMGR_QUEUE
– CHECKPOINT_QUEUE
– SLEEP_TASK
– BROKER_TO_FLUSH
Waits (continued)
• Preemptive Wait Types
• SQL Server extended events
Demo time
References
• http://msdn.microsoft.com/en-
us/library/ms179984%28v=SQL.90%29.aspx
• http://msdn.microsoft.com/en-
us/library/ms179984%28v=SQL.100%29.aspx
• http://msdn.microsoft.com/en-
us/library/ms179984%28v=SQL.105%29.aspx

Sql waits

  • 1.
    ©2011 Hewlett-Packard DevelopmentCompany, L.P. The information contained herein is subject to change without notice SQL Server 2008 WAITS Miroslav Dimitrov
  • 2.
    How SQL Serverworks ?! • SQL Server OS – Schedulers – Workers Lists to which workers can be assigned: worker waiter runnable I/O timer
  • 3.
    WAITS – Whatare they ?! • SQL Server 2000 – DBCC SQLPERF – ”sysprocesses” system view (waittype column) • SQL Server 2005 - DMVs – sys.dm_os_wait_stats – wait statistics – sys.dm_os_waiting_tasks – task-level wait information • SQL Server 2008 – new waits – Solve the problem with fine-grained analysis of wait statistics in SQL Server 2005
  • 4.
    Types of WAITS •Resource waits • Queue waits • External waits A SQL Server worker thread is not considered to be waiting if any of the following is true: • A resource becomes available. • A queue is nonempty. • An external process finishes.
  • 5.
    Waits • Memory Waits –CMEMTHREAD – RESOURCE_SEMAPHORE • Disk I/O Waits – IO_COMPLETION – ASYNC_IO_COMPLETION – WRITELOG – PAGEIOLATCH_* • Blocking waits – LCK_*
  • 6.
    Waits (continued) • CPU –CXPACKET – SOS_SCHEDULER_YIELD • Network Waits – ASYNC_NETWORK_IO – DBMIRROR_SEND • System waits – LAZYWRITER_SLEEP – REQUEST_FOR_DEADLOCK_SEARCH – SQLTRACE_BUFFER_FLUSH – XE_TIMER_EVENT – FT_IFTS_SCHEDULER_IDLE_WAIT – LOGMGR_QUEUE – CHECKPOINT_QUEUE – SLEEP_TASK – BROKER_TO_FLUSH
  • 7.
    Waits (continued) • PreemptiveWait Types • SQL Server extended events
  • 8.
  • 9.