• 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
    DRV Technologies, Inc.

    Get More from Your IBM i

    Many users today struggle to get at the data they need on the IBM i. When users get reports, they look like they were formatted some time last century.

    Some organizations are still printing pre-printed forms and checks on impact printers.

    How often do operators log on to their system to look for messages they hope they don’t find?

    All of these scenarios can affect users’ perception of the IBM platform negatively, but there are simple solutions.

    DRV Technologies Inc. develops innovative solutions that help customers get more from their IBM i systems.

    Solutions include:

    • SpoolFlex spool conversion & distribution
    • FormFlex electronic forms
    • SecureChex MICR laser check printing
    • MessageFlex system monitoring

    FlexTools streamline resources, improve efficiency and enable pro-active system management.

    Better software, better service, DRV Tech.

    Learn how you can get more from your IBM i at www.drvtech.com

    Call 866 378-3366 for a Free Demonstration

    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

  • IBM Tweaks Some Power Systems Prices Down, Others Up
  • Disaster Recovery: From OS/400 V5R3 To IBM i 7.4 In 36 Hours
  • The Disconnect In Modernization Planning And Execution
  • Superior Support: One Of The Reasons You Pay The Power Systems Premium
  • IBM i PTF Guide, Volume 25, Number 13
  • IBM i Has a Future ‘If Kept Up To Date,’ IDC Says
  • When You Need Us, We Are Ready To Do Grunt Work
  • Generative AI: Coming to an ERP Near You
  • Four Hundred Monitor, March 22
  • IBM i PTF Guide, Volume 25, Number 12

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 © 2023 IT Jungle