CPU usage relative to each database

  • Hi,

    I am looking for the script to find the CPU usage for each database like this

    Test1DB76.00%

    Test2DB12.00%

    Test3DB1.21%

    Test4DB20.08%

  • ramana3327 (2/26/2015)


    Hi,

    I am looking for the script to find the CPU usage for each database like this

    Test1DB76.00%

    Test2DB12.00%

    Test3DB1.21%

    Test4DB20.08%

    What are you trying to accomplish? If you want to tune up CPU, you should looked at which ones are the TOP CPU hungry queries, not what database seems to use more CPU.

  • The only way I can think to do this would be to capture the query metrics for all the databases and then group the data. There's nothing that splits CPU use by database.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Something similar and close to question was discussed in past .

    http://www.sqlservercentral.com/Forums/Topic1316138-146-1.aspx

  • select d.name,

    sum(r.cpu_time)

    from sys.databases d join sys.dm_exec_requests r

    on d.database_id = r.database_id

    group by d.name

    order by sum(r.cpu_time) desc

Viewing 5 posts - 1 through 4 (of 4 total)

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