• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Here’s Help For A Huge Hardship

    April 16, 2014 Ted Holt

    Multimillion-row tables are more and more common in IBM i shops these days. Querying those monsters can be a strain on the system. Fortunately, IBM gave us some help in DB2 for i 7.1.

    The help comes in the form of a new wrinkle in indexing. The smart people who produce the world’s greatest relational database management system found a way to store aggregate (summary) information in encoded vector indexes. Here’s an example.

    Assume a table (physical file) of sales history, such as this one:

    create table Sales
      ( ID                integer as identity,
        Invoice           dec  (9,0),
        Line              dec  (3,0),
        InvoiceDate       date,
        Customer          dec  (7,0),
        Item              char (12),
        Quantity          dec  (3,0),
        Price             dec  (5,2),
      primary key (ID));
    

    Suppose that users commonly want to know how many of each item was sold and how much money each item placed into the company bank account. You might use a query like this one:

    select item,
           sum(quantity) as Qty,
           sum(quantity * price) as Extended
      from sales
     group by item
     order by 1
    

    Each time the query runs, the system has to rebuild the summary figures.

    You might improve performance by creating the following encoded vector index:

    create encoded vector index SalesByItem
     on sales (item)
     include (sum(quantity), sum(quantity * price))
    

    This index includes two summary figures for each item: the sum of the quantity and the sum of the quantity multiplied by the price. As rows are added to, deleted from, or changed in the table, the system adjusts the summary figures. When a query needs these figures, it can read them from the index instead of rebuilding them.

    My thanks to Tom McKinley, of IBM, who reminded me of this new feature in his informative presentations at the recent RPG & DB2 Summit in Texas. I had forgotten that this feature existed.

    RELATED STORY

    Enter the Vector, Victor!



                         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
    LightEdge

    Experience the power of fully-managed and highly secure IBM i cloud.

    Our solution ensures optimal performance for IBM i workloads that allows you to scale precisely, cut unnecessary costs, and modernize effortlessly. Benefit from our comprehensive management tools and performance metrics for streamlined infrastructure optimization.

    Elevate your IBM i today.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    Essextec:  Linux on Power. Lunch on us. A winning combination.
    LANSA:  Webinar: Mobile and the IBM i: Why Should You Care? May 21, 9 am PT/11 am CT/Noon ET
    COMMON:  Join us at the COMMON 2014 Annual Meeting & Exposition, May 4 - 7 in Orlando, Florida

    More IT Jungle Resources:

    System i PTF Guide: Weekly PTF Updates
    IBM i Events Calendar: National Conferences, Local Events, and Webinars
    Breaking News: News Hot Off The Press
    TPM @ EnterpriseTech: High Performance Computing Industry News From ITJ EIC Timothy Prickett Morgan

    Electronic Storage Taps Japanese Reseller to Carry LaserVault UBD IBM i TR8, Database Driven

    Leave a Reply Cancel reply

Volume 14, Number 9 -- April 16, 2014
THIS ISSUE SPONSORED BY:

Help/Systems
WorksRight Software
Bug Busters Software Engineering

Table of Contents

  • The Geezer’s Guide to Free-Form RPG, Part 2: Data Structures and More
  • Here’s Help For A Huge Hardship
  • Admin Alert: Elements Of An IBM i Incident Management Plan, Part 2

Content archive

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

Recent Posts

  • Fresche Bolsters MFA with IBM i Exit Point Coverage
  • AWS Taps Precisely to Bring IBM i Data Into Its Cloud
  • Government Cracks Down on Security Responses, Unpatched Vulns
  • Four Hundred Monitor, December 6
  • IBM i PTF Guide, Volume 25, Number 49
  • Getting [Stuff] Done Done With Briteskies
  • Thoroughly Modern: Practical Ways IBM i Developers Can Use AI Today
  • IBM i Momma Bear Retires
  • IBM Pushes Storage Limits With Storage Scale 6000
  • IBM i PTF Guide, Volume 25, Number 48

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