Programming Languages on Power

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power


#Servers
#Programminglanguages
 View Only
  • 1.  SQL View

    Posted 07/13/22 10:57 PM
    I have a file that roughly has about 2.5million records for a given month. This file is used heavily to process our month ends. Currently it's reading through this file and checking for specific conditions to process month end.

    In an effort to speed this job, which of these solutions are the most efficient?

    1. Create a new logical with select/omit creteria
    2. Create a temporary view run our month end jobs and drop the view


    ------------------------------
    Karthik Krishnappa
    ------------------------------

    #SQL


  • 2.  RE: SQL View

    Posted 07/14/22 02:07 AM
    A view doesn't improve performance, it only makes your program easier to code as you don't need to include a complex SQL statement.  The fact that a view externalizes the SQL also makes maintenance easier (you can change the view without recompiling your program).

    In order to speed up processing you need to create the correct SQL indexes... Visual Explain (part of Run SQL Scripts) can help you with this.

    I would not recommend logicals (with select/omit) anymore... I suggest to go "all SQL".

    ------------------------------
    Paul Nicolay
    ------------------------------



  • 3.  RE: SQL View

    Posted 07/14/22 08:17 AM
    I agree with Paul.
    I'll add that beyond VE, you or your team can also look at the Index Advisor, the statistics of any existing indexes (or keyed logical) over the file, and now also the MTIs over the file (via MTI_INFO).
    If you don't have someone in the role of Database Engineer, you could leverage Kent Milligan from IBM Lab Services to assist in either this specific task, or with database engineering education.
    Best regards, Scott

    ------------------------------
    Scott Forstie
    ------------------------------



  • 4.  RE: SQL View

    Posted 07/14/22 09:54 AM
    I'm guessing that this month-end process uses a lot of native record-level access. As Paul points out, you could go "all SQL" by creating an SQL Index with a WHERE clause to create the SQL equivalent of a Select/Omit logical.  That would provide the performance boost you're looking for in the short-term and then long-term you could migrate some of the native record-level access to SQL>

    ------------------------------
    Kent Milligan
    ------------------------------



  • 5.  RE: SQL View

    Posted 07/14/22 10:30 AM
    Thanks for all the wonderful response.

    ------------------------------
    Karthik Krishnappa
    ------------------------------



  • 6.  RE: SQL View

    Posted 07/15/22 10:17 AM
    Hey Kent, question for you.

    Why can't we use a subselect when creating am index, sure would be handy.

    CREATE INDEX mm4r6lib.invaudix1
    ON mm4r6lib.invaud (itrhot asc, itrtyp asc, itrloc asc, istype asc)
    WHERE itrhot = '1'
    AND itflag <> 'P'
    AND itrtyp IN (SELECT tblval
    FROM t1mm4r6ctl.tblfld
    WHERE tblnam = 'RCSTYP'
    AND tbldef = 'N') RCDFMT rinvaud ADD ALL COLUMNS;

    ------------------------------
    James King
    ------------------------------



  • 7.  RE: SQL View

    Posted 07/15/22 06:17 PM
    I don't seeing that happening anytime soon. 

    You're missing the point that an index exists just to possibly speed up data retrieval  & sorting of a query, not to perform additional queries.

    Instead of trying to build an SQL index with an embedded query and open it via Native Record Level access, you should just change your program to run the SQL query that's defined on the WHERE clause.  Then, you could just create indexes over INVAUD & TBLFLD using the supported syntax and I think you'll find the performance pretty acceptable.
     






    ------------------------------
    Kent Milligan
    ------------------------------