Do you have a need for detailed analysis of key performance factors that let you control and tune the performance of DB2 and DB2 application? Are you expected to proactively diagnose performance and availability problems? Or have you experienced a problem operating your DB2 server, but could not determine the cause of the problem using current snapshots, and you wished you had historical monitoring data? IBM DB2 Performance Expert is a tool which can assist you in all these tasks.
The following usage scenarios demonstrate how to analyze and resolve various performance issues and troubleshooting tasks with the help of DB2 Performance Expert V2.1:
- Determine whether or not an index could improve performance
- Review sort performance
- Check the need to reorganize tables
- Ensure there are enough DB2 agents to handle the workload
- Resolve lock conflicts
- Examing frequently used SQL statements from the package cache
- Analyze buffer pools
- Monitor system health
- In the System Overview Panel select Application Summary.
Figure 1. System Overview
- Select the appropriate application in the Application Summary view (in this example, db2bp.exe).
Figure 2. Application Summary
- Select SQL Activity in the Application Details view.
Figure 3. Application Details
The SQL Activity screen that you see in Figure 3 shows detailed information about the statements issued by the application, including units of work (UOW), cursors, rows read, rows selected, and so on. To determine whether or not we need an index, we need to look at the ratio of rows read to rows selected.
DB2 is reading 99,145 rows to select only 2,000. That is, it reads the whole table to select only 2,000 rows. The creation of an index will probably improve performance.
- In the System Overview panel select Application Summary.
- Select the appropriate application in the Application Summary view (db2bp.exe in this example).
- Select Sort in the Application Details view, as shown in Figure 4.
Figure 4. Application Details
The Sort screen shows detailed information about sort activities, including total sorts, total sort time, sort overflows, hash joins, and so on.
When a sort overflows happens, additional overhead will be incurred because the sort will require a merge phase and can potentially require more I/O, if data needs to be written to disk. To avoid sort overflow, increase the sort heap size and analyze the query to see if the query is using indexes.
Check for the need to reorganize tables
- In the System Overview Panel select Statistic Details.
Figure 5. System Overview
- Select Tables in the Statistic Details view and check Receive table information.
Figure 6. Statistic Details
The Table view in Statistic Details screen shows detailed information about tables, including table name, database name, rows written, rows read, overflowed rows, table file id, table type, page reorg, and so on.
Too many page reorganizations can result in less than optimal insert performance. If you have a high number of page reorganizations, use the REORG TABLE utility to reorganize the table and eliminate fragmentation.
Your objective here is to ensure that there are enough DB2 agents to handle the workload.
- In the System Overview Panel select Statistic Details.
- Select Instance Information in the Statistic Details view, as shown in Figure 7.
Figure 7. Statistic Details
The Instance Information view in the Statistic Details screen shows detailed information about the current instance, including instance name, current connections, agents registered, maximum agents registered, agents waiting for a token, agents assigned from pool, stolen agents, and so on.
If you find either "Agents waiting for a token" or "Stolen agents", increase the number of agents available to the database manager (MAXAGENTS and/or MAX_COORDAGENTS as appropriate).
- In the System Overview Panel select Locking Conflicts
Figure 8. System Overview
- Select the appropriate locking conflict in the Locking Conflicts view.
Figure 9. Locking Conflicts
- In order to analyze an application waiting on a lock, select a Waiter application.
Figure 10. Applications in Lock Conflicts - waiter application
- Select SQL Statement and Package from the Application Details view.
Figure 11. SQL Statement and Package for waiter application
- Also select Locks from the Application Details view.
Figure 12. Locks for waiter application
- In order to analyze an application holding locks, select a Holder application.
Figure 13. Applications in lock conflicts - holder application
- Select SQL Statement and Package from the Application Details view.
Figure 14. SQL Statement and Package for holder application
- Also select Locks from the Application Details view.
Figure 15. Locks for holder application
- To find out the user who is running that holder application, select Identification from the Application Details view.
Figure 16. User Identification for holder application
Selecting Applications in Lock Conflicts in the System Overview pane displays all applications involved in a locking situation, while the applications associated with a specific resource are shown when you select Locking Conflicts.
The Application in Lock Conflicts pane shows the holder and the waiter applications, including their application status, lock mode, lock wait time, and so on.
The SQL Statement and Package selection in the Application Details view reveals the SQL statement of the locking application.
The Locks selection in the Application Details view displays detailed locking information such as locks held by the application, deadlocks detected, lock escalations, agents waiting on locks, and so on.
The Identifcation selection in the Application Details view shows detailed information about the user who is running this application.
Examine the SQL Statements for the waiter and the holder applications. Decide on actions like comitting frequently in the application to release locks or checking on the isolation level used for the application. When performing many updates, lock the entire table for the duration of the transaction before updating. This uses only one lock and keeps others from interfering with the updates, but it does reduce concurrency of the data to other users.
Examine frequently used SQL statements from the package cache
- In the System Overview Panel select Statistic Details.
- Select Dynamic SQL Statements in the Statistic Details view.
Figure 17. Dynamic SQL statements
- Drill down further to see the statement details.
Figure 18. Statement details
The Dynamic SQL Statements view in Statistic Details screen provides detailed information on SQL statements, including databases accessed, executions, elapsed execution time, worst and best preperation time, sorts, CPU time per statement, and so on when Receive statement cache information is checked.
By pressing the Executions column in the title, shown in Figure 17, SQL statements can be sorted descending according to the number of executions, and the most frequent SQL stamements can be examined.
The Executions monitor element helps to identify the most frequently executed SQL statements in your system. In this case one query run 500 times and had 500 sorts. This is a good candidate for query optimization and checking sort values and verifying if there is a need to create new indexes.
- In the System Overview Panel select Buffer Pool Analysis.
Figure 19. System Overview
- Select File -> Generate new report in the Buffer Analysis view.
Figure 20. Buffer pool analysis
Figure 21 shows the resulting buffer pool trace report.
Figure 21. Buffer pool trace report
- Drill down for the buffer pool analysis details.
Figure 22. Buffer pool analysis details
The Buffer Pool Analysis provides buffer pool trace reports which are displayed in HTML format or interactive reports with optional graphical charts.
A buffer pool hit ratio above 80% is considered good. Ideally for an OLTP system it should be as close as possible to 100% (especially the index hit ratio).
To increase the buffer pool hit ratio, either try increasing the buffer pool size, or consider allocating multiple buffer pools, possibly one for each frequently-accessed large table with its own table space, and one for a group of small tables.
- In the System Overview Panel select System Health.
Figure 23. System overview
- Select Data View in the navigator.
Figure 24. Data view
- Right click Open Predefined Data View
Figure 25. Open Predefined Data View
- Select the database you want to monitor.
Figure 26. Open Predefined Data View - Select database
- Figure 27 illustrates the system health view.
Figure 27. System Health View
System Health displays important performance counters in graphical form in data views. You may either use predefined data views, or you can customize your own data views.
System Health is an ideal tool to graphically monitor important performance values. Once defined they will be displayed in the System Overview pane as well.
Part 1 of this article introduced the DB2 Performance Expert, and Part 2 has illustrated specific ways it can be used to make the job of tuning your databases and your systems easier. You can use DB2 PE to help you understand many factors which affect performance, such as indexes, buffer pool use, statement caching, locking, reorg requirements, and many others. In addition it can be used to warehouse performance data for later analysis, and to generate alerts based on many different factors which you can define.
Special thanks to Ute Baumbach, IBM Development Lab DB2 Performance Expert, for reviewing this article and to Cintia Y Ogura, Advanced Technical Support, IBM US, for providing education material.
- DB2 Performance Expert for Linux, UNIX and Windows Homepage gives an introduction on DB2 Performance Expert

Werner Schuetz is an IBM Certified IT Specialist, IBM Certified Advanced Database Administrator and Certified Application Developer for DB2 UDB V8. He works as a DB2 Technical Consultant in the IBM Innovation Center in Stuttgart, Germany and supports Independant Software Vendors in testing DB2 solutions, executing performance and tuning sessions and running competitve database migrations.
Comments (Undergoing maintenance)





