Most CPU intensive queries

  • Here is an attachment that lists top 9 queries consuming most CPU time. Line number 7 is most amusing to me as it shows that particular SP has been created 17163 times in the last 12 hours or so (server was rebooted 12 hours prior when this report was pulled).

    Mirroring is setup on this server. I am not sure which process is creating this SP for so many times. Any thoughts?



    Pradeep Singh

  • I checked the code behind sp_dbmmonitorupdate system stored procedure which is called every minute by the mirror monitoring job. The SP has the following code within it:

    exec @retcode = sys.sp_dbmmonitorMSgetthelatestlsn @database_name, @end_of_log_lsn output

    I can see sp_dbmmonitorupdate is calling this SP. however i cannot see dbmmonitorMSgetthelatestlsn SP in any of the databases including master/msdb/mirrored databases.

    Top 10 CPU intensive queries says this SP is created too frequently. How do i find which process is creating this SP?

    sp_dbmmonitorupdate does not have the code to create the other sp. it's just invoking it(and i cannot find that SP).

    Anyone has any ideas about it?



    Pradeep Singh

  • ps. (10/28/2010)


    Line number 7 is most amusing to me as it shows that particular SP has been created 17163 times in the last 12 hours or so (server was rebooted 12 hours prior when this report was pulled).

    How did you get that list?

    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
  • Hi Gail, I ran this query.

    select

    highest_cpu_queries.plan_handle,

    highest_cpu_queries.total_worker_time,

    q.dbid,

    q.objectid,

    q.number,

    q.encrypted,

    q.[text]

    from

    (select top 50

    qs.plan_handle,

    qs.total_worker_time

    from

    sys.dm_exec_query_stats qs

    order by qs.total_worker_time desc) as highest_cpu_queries

    cross apply sys.dm_exec_sql_text(plan_handle) as q

    order by highest_cpu_queries.total_worker_time desc

    as of now, it is occupying top slot instead of 7th position.



    Pradeep Singh

  • the DBID is 32767 which is resource db i think. is the SP created in memory as resource db is read only? i dont know if that happens.



    Pradeep Singh

  • It's not creating the proc, it's running it.

    When you query sys.dm_exec_sql_text and the handle you pass is for a running stored proc, you get back the creation script for the proc. It does not mean that the proc is being created, it means that the proc is running.

    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
  • Thanks a lot Gail. Got my answers 🙂



    Pradeep Singh

Viewing 7 posts - 1 through 6 (of 6 total)

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