Q
Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

How indexes help the query optimizer with statistics

Using the SQL performance monitor of operation navigator, I have scanned for the recommended index. In the index list, one was on QSYS2/SYSTABLES view on the QSYS/QADBXREF table. I have created the recommended index, but unfortunately it looks like the system does not use it and the SQL performance monitor still recommends it. It's a pity because it looks like this must eat a lot of CPU resources. Thanks for your answer or suggestion.

Using the SQL performance monitor of operation navigator, I have scanned for the recommended index. In the index list, one was on QSYS2/SYSTABLES view on the QSYS/QADBXREF table. I have created the recommended index, but unfortunately it looks like the system does not use it and the SQL performance monitor still recommends it. It's a pity because it looks like this must eat a lot of CPU resources. Thanks for your answer or suggestion.

Even though the query optimizer advises creating an index, it doesn't always choose to use it when creating its access plan. One reason for this is that the query optimizer does not always advise the perfect index. This is because currently, only local selection is used when determining what index to advise - it does not yet consider join, order by, or group by columns. As a result, after you create that advised index, it may not choose to use it, as it is still not the perfect index. You may need to manually intervene - examine the query and consider the join, group by, and order by columns to determine what the perfect index is and create that index.

Alternatively, it may be recommending that index so that it can extract stats from the index to further evaluate the optimal access method. For example, once the index has been created, it may be using statistics from the index to determine that that query will return many rows, and thus a table scan is the least-expensive access method.

To better understand the concept of a perfect index and how indexes help the query optimizer with statistics, you can read the Indexing Strategy white paper here.

Dig Deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close