SQL Technology Insider -13 separation of the SQL optimization methodology weight-level wait

Source: Internet
Author: User

Code

--Isolate top Waitswith Waits as (SELECT wait_type, Wait_time_ms/ +. As wait_time_s, -. * Wait_time_ms/SUM (Wait_time_ms) over () as the PCT, Row_number () over (ORDER by Wait_time_ms DESC) as RN, -. * Signal_wait_time_ms/wait_time_ms assignal_pct from sys.dm_os_wait_stats WHERE Wait_time_ms>0and wait_type not like N'%sleep%'and wait_type not like N'%idle%'and wait_type not like N'%queue%'and Wait_type not in (N'clr_auto_event', N'Request_for_deadlock_search', N'Sqltrace_buffer_flush'                         /*filter out additional irrelevant waits*/) ) SELECT W1.wait_type, CAST (w1.wait_time_s as NUMERIC ( A,2) as wait_time_s, CAST (w1.pct as NUMERIC (5,2) as PCT, CAST (SUM (w2.pct) as NUMERIC (5,2) as running_pct, CAST (w1.signal_pct as NUMERIC (5,2) as Signal_pctfrom Waits as W1 JOIN Waits as W2 on W2.rn<=W1.rngroup by W1.rn, W1.wait_type, w1.wait_time_s, w1.pct, w1.signal_pcthaving SUM (w2.pct)-w1.pct < the--percentage threshold OR w1.rn<=5ORDER by W1.rn; GO
View Code

1. Total wait time (in seconds) for the wait type from the last reboot of the system or counter emptied

2. Percentage of wait time for this type of wait time

3. The continuous percentage from the most heavyweight wait type to the current wait type.

4. Signal wait time as a percentage of waiting time, (remember, Wait_time_ms contains Signal_wait_time_ms)

SQL Technology Insider -13 separation of the SQL optimization methodology weight-level wait

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.