CPU utilization by database?

前端 未结 8 1147
情话喂你
情话喂你 2020-12-04 08:21

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

相关标签:
8条回答
  • 2020-12-04 09:05

    I think the answer to your question is no.

    The issue is that one activity on a machine can cause load on multiple databases. If I have a process that is reading from a config DB, logging to a logging DB, and moving transactions in and out of various DBs based on type, how do I partition the CPU usage?

    You could divide CPU utilization by the transaction load, but that is again a rough metric that may mislead you. How would you divide transaction log shipping from one DB to another, for instance? Is the CPU load in the reading or the writing?

    You're better off looking at the transaction rate for a machine and the CPU load it causes. You could also profile stored procedures and see if any of them are taking an inordinate amount of time; however, this won't get you the answer you want.

    0 讨论(0)
  • 2020-12-04 09:05

    Have you looked at SQL profiler?

    Take the standard "T-SQL" or "Stored Procedure" template, tweak the fields to group by the database ID (I think you have to used the number, you dont get the database name, but it's easy to find out using exec sp_databases to get the list)

    Run this for a while and you'll get the total CPU counts / Disk IO / Wait etc. This can give you the proportion of CPU used by each database.

    If you monitor the PerfMon counter at the same time (log the data to a SQL database), and do the same for the SQL Profiler (log to database), you may be able to correlate the two together.

    Even so, it should give you enough of a clue as to which DB is worth looking at in more detail. Then, do the same again with just that database ID and look for the most expensive SQL / Stored Procedures.

    0 讨论(0)
提交回复
热议问题