Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL Profiler - Can it tell you how long query was blocked for Expand / Collapse
Author
Message
Posted Thursday, November 20, 2008 3:39 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 9:47 AM
Points: 48, Visits: 426
Hi, I often have situations where a lot of queries time out. However most queries time out because they are blocked by other long running queries, rather than themselves taking a long time to run (due to table scans etc). Is there any way to get SQL profiler to indicate only those queries that have long durations only as a result of themselves taking a long time to run, rather than spending all their time blocked?

Thanks
Post #605674
Posted Thursday, November 20, 2008 7:49 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 12:55 PM
Points: 11,297, Visits: 13,083
I don't believe that there is a way to do that directly in profiler. I think you could figure that out by using a combination of the lock timeout event and the CPU and duration columns of the SP:Completed or SQL:StmtCompleted events as I do not believe a process waiting for a lock to be released is using CPU time.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #605827
Posted Thursday, November 27, 2008 4:47 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, June 9, 2014 6:02 AM
Points: 2,674, Visits: 697
just a point here - generally queries only time out from the client dropping the connection not as an internal SQL Server operation unless it's a deadlock. If you set a block using a couple of sql queries you'll find they'll tend to sit there until the end of time.
I run a profiler which captures long running queries based upon duration, but you won't really know a query is long running until it's finished.
It's not difficult to query the dmvs to gather what you need either but sorting out waht's blocked and just running may be trickier



The GrumpyOldDBA
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
Post #609692
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse