Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Batch job tuning sgandhla Testing & Performance analysis 5 Fri Mar 24, 2017 9:41 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us