Temporary Indexed List scan and Index Merge
A temporary indexed list scan operation is similar to the index scan operation that is performed upon the permanent radix index. It is still used to retrieve the rows from a table in a keyed sequence; however, the temporary indexed list object must first be created. This operation is often performed in conjunction with an index merge operation. However, for some distinct and grouping queries, the temporary indexed list scan may be used without an associated index merge operation.
This access method is used when there is non-equal selection and is used in conjunction with an existing permanent radix index. A distinct index scan or a distinct index probe operation is performed against the index to get a unique set of rows. The rows are then inserted into the temporary indexed list to provide the appropriate ordering.
- Any columns with equal predicates that are not in the ORDER BY list should be first keys in the index.
- Followed by any columns for non-equal predicates that are not in the ORDER BY list. The columns should be arranged so the most selective predicate column is the first column following the equal predicate columns.
- Followed by the ORDER BY columns in the same order as the ORDER BY clause of the query and with the same ASC or DESC attribute.
- Optionally, at the end you may include other selection columns or other selected columns for Index Only Access.
A temporary sorted list is an internal data structure and can only be created by the database manager.
Data access method | Temporary indexed list scan |
---|---|
Description | Sequentially scan and process all the keys associated with the temporary indexed list. |
Advantages |
|
Considerations | Used to process ordering, grouping or distinct processing for a single table query. |
Likely to be used |
|
Example SQL statement |
|
Database Monitor and Plan Cache record indicating use | QQRID 3001 where QQRCOD = ‘I7’ |
SMP parallel enabled | No |
Also referred to as | |
Visual Explain icon |
Using the example above, the optimizer chose to create a temporary indexed list of distinct WORKDEPT values from index INDEX1. The selection SALARY > 3000 was applied to the index probe distinct.
Index Merge:
An index merge operation is used to provide ordering in conjunction with a temporary indexed list scan and an index probe distinct or distinct index.
The sequenced rows can be used by the optimizer to satisfy a portion of the query request (such as ordering or grouping).
Data access method | Index Merge |
---|---|
Description | Sequentially scan and process all the keys associated with the temporary indexed list. |
Advantages |
|
Considerations | Used to process ordering, grouping or distinct processing for a single table query. |
Likely to be used |
|
Example SQL statement |
|
Database Monitor and Plan Cache record indicating use | QQRID 3001 where QQRCOD = ‘I7’ |
SMP parallel enabled | No |
Also referred to as | |
Visual Explain icon |