Optimizing query performance using query optimization tools
Query optimization is an iterative process. You can gather performance information about your queries and control the processing of your queries.
- Verify the performance of SQL applications
You can verify the performance of an SQL application by using commands.
- Examine query optimizer debug messages in the job log
Query optimizer debug messages issue informational messages to the job log about the implementation of a query. These messages explain what happened during the query optimization process.
- Gather information about embedded SQL statements with the PRTSQLINF command
The Print SQL Information (PRTSQLINF) command returns information about the embedded SQL statements in a program, SQL package (the object normally used to store the access plan for a remote query), or service program. This information is then stored in a spooled file.
- Viewing the plan cache with iSeries Navigator
The Plan Cache contains a wealth of information about the SQE queries being run through the database. Its contents are viewable through the iSeries Navigator GUI interface.
- Monitoring your queries using memory-resident database monitor
The Memory-Resident Database Monitor is a tool that provides another method for monitoring database performance. This tool is only intended for SQL performance monitoring and is useful for programmers and performance analysts. The monitor, with the help of a set of APIs, takes database monitoring information and manages them for the user in memory. This memory-based monitor reduces CPU overhead as well as resulting table sizes.
- Using iSeries Navigator with summary monitors
You can work with summary monitors from the iSeries™ Navigator interface. A summary monitor creates a Memory-Resident Database monitor (DBMon), found on the native interface.
- 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.
- Using iSeries Navigator with detailed monitors
You can work with detailed monitors from the iSeries Navigator interface. The detailed SQL performance monitor is the iSeries Navigator version of the STRDBMON database monitor, found on the native interface.
- Query optimizer index advisor
The query optimizer analyzes the row selection in the query and determines, based on default values, if creation of a permanent index improves performance. If the optimizer determines that a permanent index might be beneficial, it returns the key columns necessary to create the suggested index.
- View the implementation of your queries with Visual Explain
You can use the Visual Explain tool with iSeries Navigator to create a query graph that graphically displays the implementation of an SQL statement. You can use this tool to see information about both static and dynamic SQL statements. Visual Explain supports the following types of SQL statements: SELECT, INSERT, UPDATE, and DELETE.
- Change the attributes of your queries with the Change Query Attributes (CHGQRYA) command
You can modify different types of attributes of the queries that you will execute during a certain job with the Change Query Attributes (CHGQRYA) CL command, or by using the iSeries Navigator Change Query Attributes interface.
- Collecting statistics with the Statistics Manager
As stated earlier, the collection of statistics is handled by a separate component called the Statistics Manager. Statistical information can be used by the query optimizer to determine the best access plan for a query. Since the query optimizer bases its choice of access plan on the statistical information found in the table, it is important that this information be current.
- Display information with Database Health Center
Use the Database Health Center to capture information about your database. You can view the total number of objects, the size limits of selected objects in your database, and the design limits of selected objects.
- Show Materialized Query Table columns
You can display materialized query tables associated with another table using iSeries Navigator.
- Manage Check Pending Constraints columns
You can view and change constraints that have been placed in a check pending state by the system. Check pending refers to a state in which a mismatch exists between a parent and foreign key in the case of a referential constraint or between the column value and the check constraint definition in the case of a check constraint.
- Query optimization tools: Comparison table
Use this table to learn what information each tool can yield about your query, when in the process a specific tool can analyze your query, and the tasks that each tool can perform to improve your query.
Parent topic:
Performance and query optimization