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.
The optimizer is able to perform radix index probe over any combination of the primary key columns, plus one additional secondary key column. Therefore it is important that the first secondary key column be the most selective secondary key column. The optimizer will use radix index scan with any of the remaining secondary key columns. While radix index scan is not as fast as radix index probe it can still reduce the number of keys selected. Hence, secondary key columns that are fairly selective should be included.
It is up to the user to determine the true selectivity of any secondary key columns and to determine whether those key columns should be included when creating the index. When building the index the primary key columns should be the left-most key columns followed by any of the secondary key columns the user chooses and they should be prioritized by selectivity.
After creating the suggested index and executing the query again, it is possible that the query optimizer will choose not to use the suggested index. The CQE optimizer when suggesting indexes only considers the selection criteria and does not include join, ordering, and grouping criteria. The SQE optimizer includes selection, join, ordering, and grouping criteria when suggesting indexes.
You can access index advisor information in many different ways. These include:
- The index advisor interface in iSeries™ Navigator
- SQL performance monitor Show statements
- Visual Explain interface
- Querying the Database monitor view 3020 - Index advised.
- Display index advisor information
You can display index advisor information from the optimizer using iSeries Navigator.
- Index advisor columns
Displays the columns that are used in the Index advisor window.
- Querying database monitor view 3020 - Index advised
The index advisor information can be found in the Database Monitor view 3020 - Index advised (SQE).
Parent topic:
Optimizing query performance using query optimization tools
Related reference
Overview of information available from Visual Explain
Database monitor view 3020 - Index advised (SQE)
Viewing statements in a monitor