Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2014
    Posts
    2

    Unanswered: Optimize a select *

    Hello,

    we have a batch in our production which do :

    Code:
    //S050     EXEC PGM=IKJEFT01,DYNAMNBR=20
    //SYSTSPRT DD SYSOUT=*                                        
    //SYSTSIN  DD *
    DSN SYSTEM(DB2R)                                  
    RUN  PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARM('SQL') 
              
    //SYSPRINT DD SYSOUT=*                                        
    //SYSREC00 DD DSN=TDF.GCV.ARCH,VOL=(,,,10),       
    //        DISP=(,CATLG,KEEP),UNIT=VTS2,LABEL=RETPD=999,       
    //        DCB=(RECFM=FB,LRECL=00053,BLKSIZE=27984)            
    //SYSPUNCH DD DUMMY                                           
    //SYSIN    DD *                                               
    SELECT * FROM TFR.KYTH                    
    ORDER  BY TG.JUY ASC, TG.FTR DESC;                     
    /*                                                            
    //*-------------------------------
    But the table : TFR.KYTH have 600 000 000 records !!!

    Is there an other way to do it and obtain the same result... Because a select * take a very long time and use lots of CPU.

    Thank's for your help.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Based on the way that you phrased your post, I'm pretty comfortable that you don't really want to spool/print the whole table.

    In order to help you optimize it, we need to understand what you want to accomplish instead of just the JCL which you are using to accomplish the task. In other words, you probably only want some part of what this JCL does, but we don't know which part you want versus which part is a "necessary evil" to get what you really want.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    ORDER BY TG.JUY ASC, TG.FTR DESC
    Is that worked? No error message didn't you got?
    Because, qualifier "TG." was not seen in any other place than the ORDER BY clause in your query.

    Is there an other way to do it and obtain the same result...
    It depends on your basic/essential requirements.

    As PatP wrote,
    if you want values of all columns of all rows(not specific columns and/or not specific rows) of the table TFR.KYTH with your specified order,
    it might be difficult to consider other way.

  4. #4
    Join Date
    Feb 2014
    Posts
    2
    Heelo.

    It works actually in our production. I works .

    It is an archive. May be we can do an unload.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •