The document discusses wait statistics and wait types in SQL Server. It provides an overview of defining, viewing, collecting and reviewing wait data using dynamic management views and wait statistics. It also simplifies the SQL Server execution model using a grocery store checkout line analogy. Specific wait types are explained such as CXPACKET, OLEDB, PAGEIOLATCH_X, PAGELATCH_X and LATCH_X. Guidelines and potential resolutions are provided for analyzing and addressing top wait events.
18. WAIT DMVS
sys.dm_os_wait_stats
Accumulated statistics on tasks that have waited for resources
sys.dm_os_waiting_tasks
Information on queued tasks waiting for resources
30. WAITING TASKS
ID of the session that is blocking the request. If this
column is NULL, the request is not blocked, or the
session information of the blocking session is not
available
39. WAIT T YPES
Tied to process
Audit
Buffer
I/O
Indexing
Lock
SQLOS
Categories
Background
External
Queue
40. BACKGROUND WAITS
CLR_SEMAPHORE CHECKPOINT_QUEUE
LAZYWRITER_SLEEP XE_TIMER_EVENT
RESOURCE_QUEUE BROKER_TO_FLUSH
Not all inclusive
SLEEP_TASK BROKER_TASK_STOP
SLEEP_SYSTEMTASK CLR_MANUAL_EVENT
WAITFOR CLR_AUTO_EVENT
LOGMGR_QUEUE XE_DISPATCHER_WAIT
41. CXPACKET
Translation
•Contention with queries the at are executing in parallel; across multiple CPUs.
Generally due to unbalanced execution across CPUs or tasks ahead of query
executing longer than expected.
Guideline
•>5% for OLTP
•>10% for data warehouses
Resolution
•Review indexing
•Tune queries
•Adjust Max Degree of parallelism
•Research cost threshold for parallelism
42. OLEDB
Translation
• Occurs when SQL Server calls the Microsoft SQL Native Client OLE DB
Provider. It indicates the duration of calls to the OLE DB provider.
Guideline
• Examine when it is a top wait and exceeds background waits. (TOP 5)
Resolution
• Identify queries with OLE DB waits with extended events or
sys.dm_os_waiting_tasks
• Check application placement and Disk secs/Read and Disk secs/Write
• Tune transactions using RPC, Distributed (Linked Server), and Full Text
Search
43. PAGEIOLATCH_X
Translation
• Contention caused by disk to memory transfer. Typically suggests disk IO
subsystem issues.
Guideline
• Examine when it is a top wait and exceeds background waits. (TOP 5)
Resolution
• Review Physical disk: disk seconds/read and Physical disk: disk
seconds/write and SQL Server Buffer Manager: Page Life Expectancy
• Review information for virtual file stats
• Reconfigure disk to improve IO throughput
• Analyze indexes to reduce need to move data to memory
• Increase memory to increase data available to SQL Server
44. PAGELATCH_X
Translation
• Contention between short term light weight synchronization objects.
Latches are not held for the duration of a transaction. Occur in the
buffer pool but unrelated to IO requests.
Guideline
• Examine when it is a top wait and exceeds background waits. (TOP 5)
Resolution
• Check tempdb configuration
• Additional data files
• Trace Flag 1118
• Troubleshoot memory pressure
45. LATCH_X
Translation
• Contention between short term light weight synchronization objects.
Latches are not held for the duration of a transaction. Non buffer
pool related.
Guideline
• Examine when it is a top wait and exceeds background waits. (TOP 5)
Resolution
• Review T-SQL generating LATCH waits using extended events.
• Examine memory items in sys.dm_os_latch_stats
• Partition table across multiple files
46. SQL SERVER MVP DEEP DIVES, VOLUME 2
www.operationsmile.org
www.manning.com/delaney