Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you use COUNT operator to set a return code of 12 or 4 if a specified data set is EMPTY, NOTEMPTY, HIGHER(n), LOWER(n), EQUAL(n) or NOTEQUAL(n). where n is a specified number of records. If you use the RC4 operand, SORT sets RC=4; otherwise it sets RC=12. E.g. COUNT FROM(IN) EMPTY

Google
 
Web mainframegurukul.com

DB2 PERFORMANCE TUNING TIPS

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DB2 SQL - DB2 PROGRAMMING
  View previous topic :: View next topic  
Author Message
Krishna
Site Admin


Joined: 27 Jan 2006
Posts: 1026

PostPosted: Mon Nov 20, 2006 3:11 pm    Post subject: DB2 PERFORMANCE TUNING TIPS Reply with quote

DB2 PERFORMANCE TUNING TIPS

This thread is dedicated to discussion on DB2 PERFORMANCE TUNNING TIPS.
I am requesting members of this board to post performane tuning tips here.

Regards,
Krishna
www.geocities.com/srcsinc
www.ibmmainframeguru.com
www.jacharya.com
Back to top
View user's profile Send private message Send e-mail

kumar_log@hotmail.com
Member


Joined: 28 Jan 2009
Posts: 6
Location: Singapore

PostPosted: Wed Jan 28, 2009 7:49 pm    Post subject: Reply with quote

Hi,

Please help me in my below DB2 query to run faster. Currently it is taking around 1 hour to complete.

SELECT A.C_AC_ID_C
,A.C_N
,A.C_AC_PRNT_ID_C
,A.C_AC_EF_D
,E.OFCE_ID_C
,B.DOC_RQR_D
,B.DOC_TYP_C
,C.DOC_TYP_T
,D.INTL_ID_C
,E.DEPT_ID_C
,B.DOC_STAT_TYP_C

FROM CAC.TC_AC_COMBD A,
CAC.TDOC_STAT B,
CAC.TDOC_REF C,
CAC.TC_AC_INTL_ID_XREF D,
PRD.TSR_OLD_ID E
WHERE A.C_AC_T_ACTY_STAT_I = ' ' AND
A.C_AC_EF_D > 20011004 AND
A.C_AC_ID_C = B.C_AC_ID_C AND

((B.DOC_STAT_TYP_C = 'R' AND
B.DOC_TYP_C = C.DOC_TYP_C AND
B.DOC_TYP_C IN ('01', '02', 'PAR'))
OR
(B.DOC_STAT_TYP_C = 'R' AND
A.C_AC_ID_C BETWEEN '7 ' AND '799999' AND
B.DOC_TYP_C NOT IN ('ACAP', 'OBFN', 'PAR', 'QB',
'Q13', 'RA', 'TAOP', '03', '10',
'14', '38', '45', '77', '8BEN',
'94', '95') AND
B.DOC_TYP_C = C.DOC_TYP_C)
OR
(B.DOC_STAT_TYP_C = 'F' AND
B.DOC_TYP_C = C.DOC_TYP_C AND
B.DOC_TYP_C = 'PAC')) AND

(A.C_AC_ID_C = D.C_AC_ID_C AND
D.INTL_ID_TYP_C = 'L1') AND
SUBSTR(D.INTL_ID_C,1,6) = E.SR_OLD_ID_C AND
E.EM_GRP_C = 'E'

ORDER BY E.OFCE_ID_C, E.DEPT_ID_C, D.INTL_ID_C,
A.C_AC_ID_C, B.DOC_TYP_C




One more similar query is there

SELECT A.C_AC_ID_C
,A.C_N
,A.C_AC_PRNT_ID_C
,A.C_AC_EF_D
,E.OFCE_ID_C
,B.DOC_RQR_D
,B.DOC_TYP_C
,C.DOC_TYP_T
,A.SR_PRIM_ID_C
,E.DEPT_ID_C
,B.DOC_STAT_TYP_C

FROM CAC.TC_AC_COMBD A,
CAC.TDOC_STAT B,
CAC.TDOC_REF C,
PRD.TSR_OLD_ID E

WHERE A.C_AC_T_ACTY_STAT_I = ' '
AND A.C_AC_EF_D > 20020606
AND A.C_AC_ID_C = B.C_AC_ID_C

AND ((B.DOC_STAT_TYP_C = 'R'
AND B.DOC_TYP_C IN ('01', '02', 'PAR'))
OR
(B.DOC_STAT_TYP_C = 'R'
AND A.C_AC_ID_C BETWEEN '7 ' AND '799999'
AND B.DOC_TYP_C NOT IN ('ACAP', 'OBFN', 'PAR', 'QB',
'Q13', 'RA', 'TAOP', '03',
'10', '14', '38', '45', '77',
'8BEN', '94', '95'))
OR
(B.DOC_STAT_TYP_C = 'F'
AND B.DOC_TYP_C = 'PAC'))

AND B.DOC_TYP_C = C.DOC_TYP_C
AND E.SR_OLD_ID_C = A.SR_PRIM_ID_C
ORDER BY E.OFCE_ID_C,
E.DEPT_ID_C,
A.SR_PRIM_ID_C,
A.C_AC_ID_C,
B.DOC_TYP_C



Please help me out to run faster. What kind of performance tuning process can be done.
_________________
Thanks and Regards,
L.Kumar
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

PostPosted: Thu Jan 29, 2009 10:31 am    Post subject: db2 performance tuning tips Reply with quote

Hi,

welcome to mainframegurukul.com.

My suggestions to improve above queries are :

1. Define index on the fields used in Where clause.
2. some of the comparisons can be done after fetching the record.
i.e., instead having those many conditions in WHERE clause
code important conditions in query. rest of the conditions , you
can code in application program, after fetching the record.





Suggestion: Please dont reply to the existing thread for new questions.
Please start a new topic by clicking "POST" button.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
kumar_log@hotmail.com
Member


Joined: 28 Jan 2009
Posts: 6
Location: Singapore

PostPosted: Fri Feb 13, 2009 12:00 am    Post subject: Re: db2 performance tuning tips Reply with quote

Thanks for the response. It works for me.
_________________
Thanks and Regards,
L.Kumar
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

PostPosted: Thu Apr 09, 2009 2:43 pm    Post subject: Reply with quote

DB2 V8 feature multi-row FETCH reduce 50% CPU time. You can observe good CPU time reduction, if you are fetching more records.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

PostPosted: Thu Apr 09, 2009 2:44 pm    Post subject: Reply with quote

Testing has shown up to a 40% CPU time reduction when using multi-row INSERT
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
kumar_log@hotmail.com
Member


Joined: 28 Jan 2009
Posts: 6
Location: Singapore

PostPosted: Fri May 08, 2009 7:26 pm    Post subject: Reply with quote

Hi Natarajan,

When i ran the above query as in SPUFI, it ran in 40 sec, rows retrieved was 2.
But when i ran the same query in COBOL program, it took 2+ hours to complete.

I'm planning to reduce down the "where" condition.
Do you have any further idea.
_________________
Thanks and Regards,
L.Kumar
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

PostPosted: Sun May 10, 2009 8:08 am    Post subject: Reply with quote

That much time difference between SPUFI & COBOL wont be there.
Try using with UR at the end of the select in COBOL
Update your BIND card for proper locking mechanisms.

Yes. decreasing where clause will definitely will help in increasing performance.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
arunaa27
Member


Joined: 08 Jul 2009
Posts: 2
Location: Bloomington,IL,USA

PostPosted: Sat Aug 01, 2009 2:05 am    Post subject: Reply with quote

Hi,
You can consider the following for better performance in general aspects. I am posting this message even though it is not related to your question...

1) You can always use DISTINCT clause (unless your requeirement needs duplicate values).
2) Please avoid DB2 built-in functions like SUBSTR, RTRIM, etc in an non-indexed fields.

Thanks,
Arun
_________________
Arun
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DB2 SQL - DB2 PROGRAMMING All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Sticky: MainframeTutorials.com 8 Krishna 18835 Sun Sep 19, 2010 9:36 am
Anuj Dhawan View latest post
No new posts Welcome to ibmmainframeguru.com / mainframegurukul.com 2 Krishna 11462 Wed Jan 19, 2011 1:14 pm
orissajobs View latest post
No new posts I need a JCL to delete the last 6 lines of all the members i 3 osurendhra 14159 Tue Mar 30, 2010 1:39 pm
Anuj Dhawan View latest post
No new posts How we can access PDS and its Members thru COBOL ? 5 narendra_darwani 4784 Mon Aug 10, 2009 10:09 am
narendra_darwani View latest post
No new posts www.uscareerbank.com 0 prabakarank 5438 Mon Apr 27, 2009 2:59 pm
prabakarank View latest post
 





Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-1281.html