Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to optimize the query to improve the performance

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sankar_MF

New User


Joined: 19 Sep 2006
Posts: 29

PostPosted: Thu Apr 16, 2009 12:40 pm    Post subject: How to optimize the query to improve the performance
Reply with quote

For this condition, there are around 600000 records available in the table.
This query takes more than 1 hour to complete.
Can any please tell me , how to optimize the following query to improve its performance.

Code:
SELECT B.CUST_ID
        , A.ADR_HOME
     FROM PROD.TABLE1 A,
          PROD.TABLE2 B
    WHERE A.ADR_FMT = 'EMAIL'
      AND  A.ZIP5_CDE = ' '
       AND  B.ADDR_TYPE = 'EMAIL'
      AND A.ZIP5_CDE = B.ZIP5_CDE
      AND A.ADR_ID = B.ADR_ID
  WITH UR
  ;



Thanks
Sankar
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu Apr 16, 2009 2:51 pm    Post subject: Reply to: How to optimize the query to improve the performan
Reply with quote

Little or nothing exact can be offered without an EXPLAIN.

By the way db2 tables have ROWs not RECORDs.

There are plenty of Threads on Explain, use the search facility.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Apr 16, 2009 3:02 pm    Post subject:
Reply with quote

A.ZIP5_CDE is checked for spaces .. and you are using this column to join ??? Post the table indices .... o/p of EXPLAIN ....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts CONTIG for performance? JPVRoff JCL & VSAM 7 Fri Jun 09, 2017 8:39 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us