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

Tuning Db2 StoredProcedure


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prasanthiv

New User


Joined: 07 Dec 2008
Posts: 6
Location: INDIA

PostPosted: Sun Nov 27, 2011 8:11 pm
Reply with quote

Hi, we have DB2 SP being called from Batch Program for 400000 times. SP has nearly 40 SQL Queries to execute for each call from Batch Program. Nearly 30 SQL Queries are using SUM function.

Currently this process is taking 24 Min CPU time and 4-5Hrs of Elapsed Time.

Now we are in the process of fine tune this process.
I would like to know in general how many maximum SQL queries can be coded inside SP?
How many max input calls allowed for SP for better performance?

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

Global Moderator


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

PostPosted: Sun Nov 27, 2011 9:25 pm
Reply with quote

why are you looking at the SP to fine tune,
when it sounds as if the whole process needs to be revamped?

is this a daily, weekly, monthly, quarterly run?

you mention SUM; have you thought about MQT - Materialized Query Tables or simply building and storing aggregate values.

Tuning any SQL means eventually you reach a point where the time involved means
data has to be crunched and it takes time.

you need to reduce the 400000 CALLs and the 40 queries.
that is 16 million sql invokations (CALLs to db2)
which in itself (just forget about what the query has to do) takes time.

and these questions:
Quote:
I would like to know in general how many maximum SQL queries can be coded inside SP?
How many max input calls allowed for SP for better performance?

sounds as if you are one of Mac's mechanics -- making the horn blow louder since the breaks can not be fixed.
Back to top
View user's profile Send private message
prasanthiv

New User


Joined: 07 Dec 2008
Posts: 6
Location: INDIA

PostPosted: Sun Nov 27, 2011 9:40 pm
Reply with quote

Thanks for your reply. This is a weekly Job. Yes Exactly we need to change the whole process. I am thinking of shifting to Parallel processing to handle 400000 CALLs. Is there any better way apart from running SP parallel y ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Nov 28, 2011 12:15 am
Reply with quote

you are not thinking about changing the process,
you consistanly want the existing process to run faster.

without knowing something of the application, tables, etc...
and knowing the goal of this batch run and how is works within the complete system,
what you are asking for is free consultant work.

suggest you look into other methods to accomplish the goal of this process,
(i.e. have the aggregation of information done with/on a different way)

just to answer your question about parallel SP tasks,
anytime you can split up the work into multiple jobs and
they do not conflict
you have the potential of speeding-up your processing,
but you would have to test in your environment to determine is there is any gain to be found.
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: Mon Nov 28, 2011 11:21 am
Reply with quote

Hello,

Quote:
Hi, we have DB2 SP being called from Batch Program for 400000 times. SP has nearly 40 SQL Queries to execute for each call from Batch Program.
Make sure you know who decided was a proper approach and make sure thry are no longer to provide this kind of specification.

Had anyone done anything approaching volume testing of this process, it wold have been seen that the approach was self-defeating. What happens here quite often is someone has this "great idea" implements the design/code and runs a few iterations and decide this is good. Then when the normal volume is run, it all comes crashing done.

If you discard this now and implement a better solutiin, you will save considerable lost time & effort.
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 COBOL Performance Tuning COBOL Programming 6
No new posts Workload Manager definitions for Tuni... All Other Mainframe Topics 0
No new posts Batch job tuning Testing & Performance 6
No new posts PL/I code tuning/Performance improvement PL/I & Assembler 4
No new posts Performance tuning of Online system All Other Mainframe Topics 2
Search our Forums:

Back to Top