Monitoring your queries using Start Database Monitor (STRDBMON)
Start Database Monitor (STRDBMON) command gathers information about a query in real time and stores this information in an output table. This information can help you determine whether your system and your queries are performing as they should, or whether they need fine tuning. Database monitors can generate significant CPU and disk storage overhead when in use.
You can gather performance information for a specific query, for every query on the server, or for a group of queries on the server. When a job is monitored by multiple monitors, each monitor is logging rows to a different output table. You can identify rows in the output database table by each row's unique identification number.
What kinds of statistics you can gather
The database monitor provides the same information that is provided with the query optimizer debug messages (Start Debug (STRDBG)) and the Print SQL information (PRTSQLINF) command. The following is a sampling of the additional information that will be gathered by the database monitors:
- System and job name
- SQL statement and sub-select number
- Start and end timestamp
- Estimated processing time
- Total rows in table queried
- Number of rows selected
- Estimated number of rows selected
- Estimated number of joined rows
- Key columns for advised index
- Total optimization time
- Join type and method
- ODP implementation
How you can use performance statistics
You can use these performance statistics to generate various reports. For instance, you can include reports that show queries that:
- Use an abundance of the server resources.
- Take an extremely long time to execute.
- Did not run because of the query governor time limit.
- Create a temporary index during execution
- Use the query sort during execution
- Might perform faster with the creation of a keyed logical file containing keys suggested by the query optimizer.
A query that is canceled by an end request generally does not generate a full set of performance statistics. However, it does contain all the information about how a query was optimized, with the exception of runtime or multi-step query information.
- Start Database Monitor (STRDBMON) command
The Start Database Monitor (STRDBMON) command starts the collection of database performance statistics for a specified job, for all jobs on the system or for a selected set of jobs. The statistics are placed in a user-specified database table and member. If the table or member do not exist, one is created based on the QAQQDBMN table in library QSYS. If the table and member do exist, the record format of the specified table is verified to insure it is the same.
- End Database Monitor (ENDDBMON) command
The End Database Monitor (ENDDBMON) command ends the collection of database performance statistics for a specified job, all jobs on the system or a selected set of jobs (for example, a generic job name).
- Database monitor performance rows
The rows in the database table are uniquely identified by their row identification number. The information within the file-based monitor (Start Database Monitor (STRDBMON)) is written out based upon a set of logical formats which are defined in the Database Monitor formats. These views correlate closely to the debug messages and the Print SQL Information (PRSQLINF) messages.
- 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.
Parent topic:
Optimizing query performance using query optimization tools
Related information
Start Debug (STRDBG) command
Print SQL Information (PRTSQLINF) command
Start Database Monitor (STRDBMON) command