THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Rob Farley

- Owner/Principal with LobsterPot Solutions (a MS Gold Partner consulting firm), Microsoft Certified Master, Microsoft MVP (SQL Server), APS/PDW trainer and leader of the SQL User Group in Adelaide, Australia. Rob is a former director of PASS, and provides consulting and training courses around the world in SQL Server and BI topics.

Waiting, waiting…

Hi! - Great that you've found this page, but it's no longer here! You can find the content over at: http://blogs.lobsterpot.com.au/2013/12/10/waiting-waiting/

Published Tuesday, December 10, 2013 11:17 AM by Rob Farley

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Robert L Davis said:

Thanks for participating in T-SQL Tuesday #49!

December 13, 2013 4:14 PM
 

murali said:

Hey Rob,

Thanks for the code, do you mind helping the same with SQL SERVER 2008 or 2008 R2. As We donot have LEAD or LAG functions.

Thanks in advance.

Regards

Murali

December 23, 2013 10:26 AM
 

Rob Farley said:

Sorry - forgot to get back to this after Christmas.

Use this code to avoid using 2012 features:

with numbered as (

   select *, row_number() over (partition by wait_type order by snapshot_time desc) as rownum

   from monitoring.waits

)

select  w1.wait_type, w2.snapshot_time,

       w1.waiting_tasks_count - w2.waiting_tasks_count as diff_wait_count,

       w1.wait_time_ms - w2.wait_time_ms as diff_wait_time,

       1000 * datediff(second, w2.snapshot_time, w1.snapshot_time) as diff_ms

from numbered w1

join numbered w2 on w2.wait_type = w1.wait_type

where w1.rownum = 1 and w2.rownum = 2

order by diff_wait_time desc, wait_type;

January 27, 2014 4:49 AM

Leave a Comment

(required) 
(required) 
Submit

This Blog

Syndication

Tags

No tags have been created or used yet.

News

News? Haven't you read my blog?

My Company


Can't find something?

Contact Me

IM: rob_farley@hotmail.com
Twitter: @rob_farley
Skype: rob_farley
E: rob_farley@hotmail.com

MVP (SQL Server)




Certifications








Adelaide SQL UG

Privacy Statement