IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Tuning on below DB2 query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Fri Aug 06, 2010 11:18 pm
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

Superior Member


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

PostPosted: Mon Aug 09, 2010 2:26 pm
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
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: 577
Location: USA

PostPosted: Mon Aug 09, 2010 9:12 pm
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
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

Moderator Emeritus


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

PostPosted: Tue Aug 10, 2010 7:58 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top