Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 112331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:31:40+00:00 2026-05-11T02:31:40+00:00

Is it possible to get a breakdown of CPU utilization by database ? I’m

  • 0

Is it possible to get a breakdown of CPU utilization by database?

I’m ideally looking for a Task Manager type interface for SQL server, but instead of looking at the CPU utilization of each PID (like taskmgr) or each SPID (like spwho2k5), I want to view the total CPU utilization of each database. Assume a single SQL instance.

I realize that tools could be written to collect this data and report on it, but I’m wondering if there is any tool that lets me see a live view of which databases are contributing most to the sqlservr.exe CPU load.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:31:41+00:00Added an answer on May 11, 2026 at 2:31 am

    Sort of. Check this query out:

    SELECT total_worker_time/execution_count AS AvgCPU   , total_worker_time AS TotalCPU , total_elapsed_time/execution_count AS AvgDuration   , total_elapsed_time AS TotalDuration   , (total_logical_reads+total_physical_reads)/execution_count AS AvgReads  , (total_logical_reads+total_physical_reads) AS TotalReads , execution_count    , SUBSTRING(st.TEXT, (qs.statement_start_offset/2)+1   , ((CASE qs.statement_end_offset  WHEN -1 THEN datalength(st.TEXT)   ELSE qs.statement_end_offset   END - qs.statement_start_offset)/2) + 1) AS txt   , query_plan FROM sys.dm_exec_query_stats AS qs   cross apply sys.dm_exec_sql_text(qs.sql_handle) AS st   cross apply sys.dm_exec_query_plan (qs.plan_handle) AS qp  ORDER BY 1 DESC 

    This will get you the queries in the plan cache in order of how much CPU they’ve used up. You can run this periodically, like in a SQL Agent job, and insert the results into a table to make sure the data persists beyond reboots.

    When you read the results, you’ll probably realize why we can’t correlate that data directly back to an individual database. First, a single query can also hide its true database parent by doing tricks like this:

    USE msdb DECLARE @StringToExecute VARCHAR(1000) SET @StringToExecute = 'SELECT * FROM AdventureWorks.dbo.ErrorLog' EXEC @StringToExecute 

    The query would be executed in MSDB, but it would poll results from AdventureWorks. Where should we assign the CPU consumption?

    It gets worse when you:

    • Join between multiple databases
    • Run a transaction in multiple databases, and the locking effort spans multiple databases
    • Run SQL Agent jobs in MSDB that ‘work’ in MSDB, but back up individual databases

    It goes on and on. That’s why it makes sense to performance tune at the query level instead of the database level.

    In SQL Server 2008R2, Microsoft introduced performance management and app management features that will let us package a single database in a distributable and deployable DAC pack, and they’re promising features to make it easier to manage performance of individual databases and their applications. It still doesn’t do what you’re looking for, though.

    For more of those, check out the T-SQL repository at Toad World’s SQL Server wiki (formerly at SQLServerPedia).

    Updated on 1/29 to include total numbers instead of just averages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 101k
  • Answers 101k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Using a string is a very good idea. Remember that… May 11, 2026 at 8:07 pm
  • Editorial Team
    Editorial Team added an answer In order to work with newer versions of Windows' policy… May 11, 2026 at 8:07 pm
  • Editorial Team
    Editorial Team added an answer I'm not sure if I understand your question correctly but… May 11, 2026 at 8:07 pm

Related Questions

Is it possible to get a breakdown of CPU utilization by database ? I'm
I have a Django model with a large number of fields and 20000+ table
Is it possible to get a thread dump of a Java Web Start application?
Is it possible to get a list of all files modified/added/deleted by a particular
Is it possible to get a URL from an action without knowing ViewContext (e.g.,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.