Home > Ask the AS/400 Experts > DB2/400 and DB2 UDB Questions & Answers > How indexes help the query optimizer with statistics
Ask The iSeries 400 Expert: Questions & Answers
EMAIL THIS

How indexes help the query optimizer with statistics

Kent Milligan EXPERT RESPONSE FROM: Kent Milligan

Pose a Question
Other iSeries 400 Categories
Meet all iSeries 400 Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 28 September 2005
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.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
DB2 UDB (universal databases)
Oracle boasts 11g on SPARC is faster than IBM DB2 on Power 595
When is the YES option for 'reuse deleted files' function the best choice?
Monitoring members 'stuck' within a physical file on an EDI system
Developing tables in a parent-child relationship in DB2
SQL server error message -321
Creating a host variable of the 'where in' statement in SQL
Choose which column names are returned via ODBC when working with DB2 files
Access path and an open data path differences
Database performance comparisons on IBM i
Implement variables in SQL when creating an alias
DB2 UDB (universal databases) Research

DB2/400 and DB2 UDB
When is the YES option for 'reuse deleted files' function the best choice?
Monitoring members 'stuck' within a physical file on an EDI system
Developing tables in a parent-child relationship in DB2
SQL server error message -321
Creating a host variable of the 'where in' statement in SQL
Choose which column names are returned via ODBC when working with DB2 files
Allow access to data from a stored procedure result set using COBOL or RPG
Access path and an open data path differences
Convert a numeric physical file to a character in SQL without leading zeros
Inserting data from a CTE into a file in SQL

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



iSeries Networking - Printing, Remote Access, TCP/IP
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts