Wait Statistics Query

  • Hi

    Im running the following query to display Wait stats. The query retrieves the sql text, my question is: Is this the Sql Text that is waiting to execute, or is it the SQL text that belongs to the process causing the wait for this row?

    Thanks

    SELECT W.SESSION_ID,

    W.WAIT_DURATION_MS,

    W.WAIT_TYPE,

    W.BLOCKING_SESSION_ID,

    W.resource_description,

    S.PROGRAM_NAME,

    T.TEXT,

    T.DBID,

    S.CPU_TIME,

    S.MEMORY_USAGE

    FROM sys.dm_os_waiting_tasks W

    INNER JOIN sys.dm_exec_sessions S ON

    W.session_id = S.session_id

    INNER JOIN sys.DM_EXEC_REQUESTS R ON

    S.session_id = R.session_id

    OUTER APPLY sys.dm_exec_sql_text (R.SQL_HANDLE) T

    WHERE S.is_user_process = 1

  • That query returns information relating to the waiting task.

    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
  • Great! Thanks for your help.

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

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