• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Index Advisor, Part 1

    April 4, 2012 Paul Tuohy

    The use of SQL within our applications is on the increase. After a shaky start in the early days of the AS/400, SQL has gone from strength to strength with every release of the operating system.

    The use of embedded SQL (in RPG) stabilized with V5R1 and really came into its own when free-form SQL was introduced in V5R4 and PTFed back to V5R3.

    But with SQL, and embedded SQL especially, there is always that lingering doubt about SQL performance when accessing data. We have all heard horror stories about the lights in the building dimming when a certain program was run.

    But the solution to most of these “nightmare programs” was usually a very simple one: make sure that the query engine has the right indexes to work from. Simply put, most of the performance problems came from the query engine having to build temporary access paths in order to run the requested SQL statement.

    Those of us who are developing applications (with embedded SQL) make use of Run SQL Scripts and Visual Explain to determine what indexes may be required to fine tune our statements. My colleague Skip Marchesani talked about this in his article Visual Explain for Run SQL Scripts.

    But what about all our existing programs? What about those programs we had written before we knew that indexes were good things to have? What about those programs we had written 10 years ago that are suddenly starting to go slow because of the amount of data that has accumulated in the tables? What about those programs that are vendor supplied that we don’t have the sources for, so we don’t know what the SQL statements are?

    Help Is At Hand

    While the query engine is busily running SQL statements, it is also “logging” information about all of these required access paths in a table named SYSIXADV (in QSYS2).

    You can knock yourself out by running a SELECT against this table and working your way through the mountains of information available (which is something you may want to do at a later stage). But, initially, there is a much simpler way to get to grips with the information in SYSIXADV and to quickly get required indexes in place.

    Both System i Navigator and the browser based Systems Director Navigator for i offer a very friendly interface to the information in SYSIXADV.

    Let’s have a look at the basics of using the Index Advisor function in System i Navigator. In my next article, part two of this series, we will look at a few of the other options available with Index Advisor and we will have a quick look at the same functionality in Systems Director Navigator for i.

    Index Advisor

    To access the Index Advisor in System i Navigator, expand the Databases option, right click on the name of the database and select Index Advisor>Index Advisor from the context menu, to be presented with a window similar to the one shown in Figure 1.

    Figure 1: Index Advisor.

    When you first open Index Advisor, the columns you see will be in a different sequence from those shown in Figure 1. I changed the sequence by pressing F12 (or you could select View>Customize this View>Columns from the menu) and specifying the sequence I required.

    But what about the information displayed? The Index Advisor is displaying a list of recommended indexes along with a lot of information about why they would be useful.

    The list is in a descending sequence based on the number of times an index was advised (the Times Advised for Query Use column in Figure 1).

    In part two, we will take a closer look at some of the information presented in the Index Advisor but, for the moment, let’s say we want to create one of the recommended indexes.

    First of all, check the Estimated Index Creation Time column. You might want to pick a different time depending on how long it is going to take.

    Simply right click on the required line in the list and select Create Index from the context menu. You will be presented with the standard New Index window (as shown in Figure 2), all you have to do is enter the name of the index and click OK to create it.

    Figure 2: New Index window for an Advised Index.

    Word of Warning

    The SYSIXADV table can contain a lot of information. When you open the Index Advisor window the full contents of SYSIXADV are not retrieved. So, when you page down, there can be a delay while the next group of rows are retrieved.

    Part Two

    In part two, we will have a look at some more of the information available in Index Advisor and at some of the other options available. We will also take a peek at the Index Advisor functionality available in Systems Director Navigator for i.

    Paul Tuohy is CEO of ComCon, an iSeries consulting company, and is one of the co-founders of System i Developer, which hosts the RPG & DB2 Summit conferences. He is an award-winning speaker who also speaks regularly at COMMON conferences, and is the author of “Re-engineering RPG Legacy Applications,” “The Programmers Guide to iSeries Navigator,” and the self-study course called “iSeries Navigator for Programmers.” Send your questions or comments for Paul to Ted Holt via the IT Jungle Contact page.

    RELATED STORY

    Visual Explain for Run SQL Scripts



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    i Believe:  FREE community event: i Believe. May 4. Get more info or register now!
    BCD:  Stop Spinning Your Wheels. Develop new IBM i web apps very fast with WebSmart
    COMMON:  Join us at the 2012 Conference & Expo, May 6 - 9 in Anaheim, CA

    IT Jungle Store Top Book Picks

    BACK IN STOCK: Easy Steps to Internet Programming for System i: List Price, $49.95

    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The iSeries Pocket Database Guide: List Price, $59
    The iSeries Pocket SQL Guide: List Price, $59
    The iSeries Pocket WebFacing Primer: List Price, $39
    Migrating to WebSphere Express for iSeries: List Price, $49
    Getting Started with WebSphere Express for iSeries: List Price, $49
    The All-Everything Operating System: List Price, $35
    The Best Joomla! Tutorial Ever!: List Price, $19.95

    Dell ‘Wyses’ Up with Thin Client Acquisition Some Thoughts About IBM’s Next Generation Platform

    Leave a Reply Cancel reply

Volume 12, Number 8 -- April 4, 2012
THIS ISSUE SPONSORED BY:

WorksRight Software
Infor
CNX

Table of Contents

  • Index Advisor, Part 1
  • Cut the Gordian Knot
  • Admin Alert: Readers Check in on Four Simple Rules for PTFs

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle