Db2 – CPU Utilization by Long running Query

db2

Is there any way to find how much CPU is getting consumed by a query running for long time in Database?

Best Answer

There are several options because DB2 LUW has the older snapshot monitoring and a new monitoring facility integrated into the Workload Manager. Both facilities offer views and table functions to consume the data as well as tools on top.

For an easy way to start I would suggest to use db2top. Connect to a database and use, e.g., "D" to go to the Dynamic SQL screen. It shows Execution Time, CPU Time, Rows Read and Written, and some more information.

As an alternative take a look at the total_cpu_time monitoring element. There are functions and views listed in which that time is reported back.