Database monitor examples
The iSeries™ navigator interface provides a powerful tool for gathering and analyzing performance monitor data using database monitor. However, you may want to do your own analysis of the database monitor files.
Suppose you have an application program with SQL statements and you want to analyze and performance tune these queries. The first step in analyzing the performance is collection of data. The following examples show how you might collect and analyze data using Start Database Monitor (STRDBMON) and End Database Monitor (ENDDBMON) commands. Performance data is collected in LIB/PERFDATA for an application running in your current job. The following sequence collects performance data and prepares to analyze it.
- STRDBMON FILE(LIB/PERFDATA) TYPE(*DETAIL). If this table does not already exist, the command will create one from the skeleton table in QSYS/QAQQDBMN.
- Run your application
- ENDDBMON
- Create views over LIB/PERFDATA using the SQL DDL. Creating the views is not mandatory. All of the information resides in the base table that was specified on the STRDBMON command. The views simply provide an easier way to view the data.
You are now ready to analyze the data. The following examples give you a few ideas on how to use this data. You should closely study the physical and logical view formats to understand all the data being collected so you can create queries that give the best information for your applications.
- Database monitor performance analysis example 1
Determine which queries in your SQL application are implemented with table scans. The complete information can be obtained by joining two views: QQQ1000, which contains information about the SQL statements, and QQQ3000, which contains data about queries performing table scans.
- Database monitor performance analysis example 2
Similar to the preceding example that showed which SQL applications were implemented with table scans, the following example shows all queries that are implemented with table scans.
- Database monitor performance analysis example 3
Your next step may include further analysis of the table scan data. The previous examples contained a column titled Index Advised. A 'Y' (yes) in this column is a hint from the query optimizer that the query may perform better with an index to access the data. For the queries where an index is advised, notice that the rows selected by the query are low in comparison to the total number of rows in the table. This is another indication that a table scan may not be optimal. Finally, a long execution time may highlight queries that may be improved by performance tuning.
- Additional database monitor examples
The following are additional ideas or examples on how to extract information from the performance monitor statistics. All of the examples assume data has been collected in LIB/PERFDATA and the documented views have been created.
Parent topic:
Monitoring your queries using Start Database Monitor (STRDBMON)
Related information
Start Database Monitor (STRDBMON) command
End Database Monitor (ENDDBMON) command