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
 

 

Tuning on below DB2 query

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

New User


Joined: 30 Apr 2009
Posts: 19
Location: chennai

PostPosted: Fri Aug 06, 2010 4:36 pm    Post subject: Tuning on below DB2 query
Reply with quote

Hi,

Below query is running fast in SPUFI. While using same in COBOL program it is taking 30 mins to complete. Could some one pls suggest the tuning technique on below query.

Code:
SELECT     LNP.ML_SC_NO
          ,LNP.RPO_ORI_CSH_AM
          ,LNP.TD_QY
          ,SCP.SC_PX_DVS_FCR_RT
          ,LNP.RPO_INT_RT
 FROM V1GCMLNP LNP, V1GCMSFN SFN, V1GCMSCP SCP
 WHERE LNP.AT_VL_DT = :BGL-COB-DT
 AND LNP.ML_SC_NO = :BGL-ML-SC-NO
 AND LNP.ML_SC_NO = SCP.ML_SC_NO
 AND LNP.DTC_BR_NO = SFN.EXT_ML_AC_NO
 AND LNP.TD_STA_CD = 'L'
 AND LNP.TD_QY <> 0
 AND LNP.RPO_ORI_CSH_AM <> 0
 AND SFN.CLI_COPER_ID = 8074
 WITH UR


Thanks in advance.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 06, 2010 11:18 pm    Post subject:
Reply with quote

Hello,

Run the cobol program again bypassing this sql. . .

How long does it run?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Aug 09, 2010 2:26 pm    Post subject:
Reply with quote

Why not run an EXPALIN and get in touch with your DBA?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Aug 09, 2010 3:02 pm    Post subject:
Reply with quote

Quote:

AND LNP.TD_QY <> 0
AND LNP.RPO_ORI_CSH_AM <> 0


1. In stead of using "not =" , it will be better if you can include an IN clause if the number of distinct values are less.

2. Check the index columns on the table, and make sure u are using the index columns also in the where clause.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Aug 09, 2010 9:12 pm    Post subject:
Reply with quote

Since you are not selecting any columns from V1GCMSFN SFN. You can only do existence checking on SFN.

Also, if your cobol program is not compiled in a recent time, see if relinking helps you with the original query.

Check to see if below works for you.
Code:

SELECT LNP.ML_SC_NO
          ,LNP.RPO_ORI_CSH_AM
          ,LNP.TD_QY
          ,SCP.SC_PX_DVS_FCR_RT
          ,LNP.RPO_INT_RT
 FROM V1GCMLNP LNP,  V1GCMSCP SCP
 WHERE LNP.AT_VL_DT = :BGL-COB-DT
 AND LNP.ML_SC_NO = :BGL-ML-SC-NO
 AND LNP.ML_SC_NO = SCP.ML_SC_NO
 AND LNP.TD_STA_CD = 'L'
 AND LNP.TD_QY <> 0
 AND LNP.RPO_ORI_CSH_AM <> 0
 AND EXISTS (SELECT 1
             FROM V1GCMSFN SFN
             WHERE SFN.CLI_COPER_ID = 8074
             AND SFN.EXT_ML_AC_NO = LNP.DTC_BR_NO)
 WITH UR


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

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Tue Aug 10, 2010 11:59 am    Post subject:
Reply with quote

I will suggest you rebind your plan to the current stats to se if this improves you Cobol execution. If not, then you should look into XPLAINs of the dynamic access vs. the application plan access.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 10, 2010 7:58 pm    Post subject:
Reply with quote

Hello,

To repeat - are you sure that the slowness of the cobol process is this sql?

Has the data volume changed since this was originally implemented?
Back to top
View user's profile Send private message
k_v_mahesh

New User


Joined: 25 May 2010
Posts: 15
Location: chennai

PostPosted: Tue Aug 17, 2010 9:04 am    Post subject: Reply to: Tuning on below DB2 query
Reply with quote

Did you try to check the compatibility of the data types in the where clause host variables.
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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am


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