SQL SERVER->> Wait Stats

Source: Internet
Author: User

The wait state is an important means of isolating SQL Server performance issues, starting at the instance level. You can probably see if SQL Server is in a tight state of resources for some time in the past. It depends on whether you have an effective performance data collection mechanism in place. Sys.dm_os_wait_stats This DMV data is collected from the last boot of the instance.

 withWaits as  (  SELECTWait_type, Wait_time_ms/  +. aswait_time_s, -.*Wait_time_ms/ SUM(Wait_time_ms) Over() aspct, row_number () Over(ORDER  byWait_time_msDESC) asRN fromsys.dm_os_wait_statsWHEREWait_type not inch      ('Clr_semaphore','Lazywriter_sleep','Resource_queue',    'Sleep_task','Sleep_systemtask','Sqltrace_buffer_flush','WAITFOR',    'clr_auto_event','clr_manual_event')    ) --filter out additional irrelevant waits    SELECTW1.wait_type,CAST(w1.wait_time_s as DECIMAL( A,2)) aswait_time_s,CAST(w1.pct as DECIMAL( A,2)) aspct,CAST(SUM(w2.pct) as DECIMAL( A,2)) asrunning_pct fromWaits asW1INNER JOINWaits asW2 onW2.rn<=W1.rnGROUP  byW1.rn, W1.wait_type, w1.wait_time_s, w1.pct having SUM(w2.pct)-w1.pct<  the;--percentage threshold;

You can use the following command to reset data collection

DBCC SQLPERF ('sys.dm_os_wait_stats', CLEAR); GO

Reference:

Https://msdn.microsoft.com/en-us/library/ms179984.aspx

SQL SERVER->> Wait Stats

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.