the importance of wait statistics in sql server

19
The Importance of Wait Statistics in Monitoring SQL Server Grant Fritchey

Upload: grant-fritchey

Post on 27-Jul-2015

205 views

Category:

Data & Analytics


1 download

TRANSCRIPT

Page 1: The Importance of Wait Statistics in SQL Server

The Importance of Wait Statistics in Monitoring SQL Server

Grant Fritchey

Page 2: The Importance of Wait Statistics in SQL Server

Get in touch

scarydba.com

[email protected]

@gfritchey

Grant Fritchey

Page 3: The Importance of Wait Statistics in SQL Server

What is a Wait?

• SQL Server does work• All the work doesn’t occur simultaneously• When a unit of work stops• Threads

– RUNNING– SUSPENDED– RUNNABLE

• Time spent between RUNNING and RUNNING

Page 4: The Importance of Wait Statistics in SQL Server

Why Are Waits Important?

• Why is the server slow• Where is the server slow• Which resources are waiting frequently• Which resources are waiting long• Direct pointer to the cause of poor performance

Page 5: The Importance of Wait Statistics in SQL Server

Where Do I Get Waits

• Sys.dm_os_wait_stats• Sys.dm_db_wait_stats• sys.dm_os_latch_stats

Page 6: The Importance of Wait Statistics in SQL Server

Are Some Waits More Important?

• LATCH_*, PAGELATCH_*• PAGEIOLATCH_*, IO_COMPLETION, WRITELOG• CXPACKET• ASYNC_NETWORK_IO• RESOURCE_SEMAPHORE• BACKUPIO• Lots and lots more• signal_wait_time_ms

Page 7: The Importance of Wait Statistics in SQL Server

Are Some Waits Less Important?

• CXPACKET• WAITFOR• CLR_SEMAPHORE• BROKER_RECEIVE_WAITFOR• ONDEMAND_TASK_QUEUE• Lots and lots more

Page 8: The Importance of Wait Statistics in SQL Server

How Do I Use This Information?

• Filter out the unimportant waits• You know where your system bottlenecks are• Is it system related?• Is it query related?• Is it structure related?

Page 9: The Importance of Wait Statistics in SQL Server

How Do I Know Which Queries Are Waiting?• Sys.dm_os_waiting_tasks

Page 10: The Importance of Wait Statistics in SQL Server

How Do I Know Which Waits A Query Has?• Sys.dm_exec_requests• Extended Events: wait_info

Page 11: The Importance of Wait Statistics in SQL Server

What Happens To Waits Over Time?• DBCC SQLPERF(“sys.dm_os_wait_stats”,CLEAR)• DBCC SQLPERF(“sys.dm_os_latch_stats”,CLEAR)• Instance restart

Page 12: The Importance of Wait Statistics in SQL Server

DEMO: Wait Stats in SQL Monitor

Page 13: The Importance of Wait Statistics in SQL Server

SQL Monitor• Clear insights into SQL Server performance

in real time• Embedded expertise• Alerting• Baselines• Wait stats & expensive queries• Custom Metrics• SQL Monitor

Page 14: The Importance of Wait Statistics in SQL Server

SQL Monitor

• Read more experiences of SQL Monitor from real customers at: www.red-gate.com/products/dba/sql-monitor

• We use it to monitor SQLServerCentral, if you want to see how it works: http://monitor.red-gate.com

Page 15: The Importance of Wait Statistics in SQL Server

Its very simple to use and doesn’t drown me in unnecessary information. It came out on top for being reasonably priced and also functionality. We now have a stable SQL Estate due to SQL Monitor.

Nic Hopper, Senior DBA, Atrium Underwriters Ltd

Page 16: The Importance of Wait Statistics in SQL Server

Documents

• SQL Server Performance Tuning Using Wait Statistics• Performance Tuning Using Waits and Queues (old, but still good)• Wait statistics, or please tell me where it hurts – Paul Randal• What Queries Are Causing My Waits – John Sterret

Page 17: The Importance of Wait Statistics in SQL Server

Thank you for your attention

Q & A

Page 18: The Importance of Wait Statistics in SQL Server
Page 19: The Importance of Wait Statistics in SQL Server