Wait Types experienced by a Query or an SID

  • Hello!

    I know how to get a list of all the wait-types experienced by the instance, using sys.dm_os_wait_stats.

    Does anyone know how to get the wait stats experienced by a particular query, or a session Id, that is currently executing?

    I know I could use sys.dm_os_waiting_tasks to get a snapshot of the current wait type stats for a session_id, but it doesn't provide an aggregation of the wait-types since the session started/query began execution.

    Cheers

    -----------------
    ... Then again, I could be totally wrong! Check the answer.
    Check out posting guidelines here for faster more precise answers[/url].

    I believe in Codd
    ... and Thinknook is my Chamber of Understanding

  • Extended Events.

    Jonathan Kehayias has an example somewhere on his blog, google should find it.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Awesome advice, worked like a charm.

    For reference, the Extended Events page on Jonathan's blog is:

    http://sqlskills.com/blogs/jonathan/category/Extended-Events.aspx

    Since am setting this up on SQL 2012, it is actually very easy and yields interesting results.

    Cheers

    -----------------
    ... Then again, I could be totally wrong! Check the answer.
    Check out posting guidelines here for faster more precise answers[/url].

    I believe in Codd
    ... and Thinknook is my Chamber of Understanding

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply