Bug in sys.dm_exec_sessions query

  • I'm getting wierd results on the below given a query, if you agree perhaps one of you can report it. Maybe it already has been.

    Microsoft SQL Server 2005 - 9.00.3282.00 (X64) Aug 5 2008 00:48:00 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

    SELECT

    session_id,login_name, program_name

    last_request_end_time,cpu_time

    FROM sys.dm_exec_sessions

    WHERE session_id >= 51

    order by cpu_time desc

    session_idlogin_namelast_request_end_timecpu_time

    171sarepl2Repl-LogReader-2-gemini-47103322379

    62sarepl2Repl-LogReader-2-Playdough-6035032381

    63sarepl2Repl-LogReader-2-card_management-5026941766

    61sarepl2Repl-LogReader-2-boi-4918662109

    80sarepl2Repl-LogReader-2-DSSL01_0906-3916796812


    John Zacharkan

  • What's weird about those results?

    Check how long those log readers have been running. It usually continuous since the last time the server was started, which could account for the high CPU time. Also note that the CPU time's in milliseconds.

    If you're wondering why the program name appears in a column titled 'last_request_end_time', it's because you left a comma out between program_name and last_request_end_time and hence that was interpreted as column and column alias..

    SELECT

    session_id,login_name, program_name ,

    last_request_end_time,cpu_time

    FROM sys.dm_exec_sessions

    WHERE session_id >= 51

    order by cpu_time desc

    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
  • :blush: Now I know I've been working too long.

    It was the column being dropped and seeing end time for my program names that had me baffled.

    Repl monitor cpu count is normal for our shop.

    Atten Sir, please step back from the keyboard!

    We live for the One, we die for the One.


    John Zacharkan

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

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