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

DB2 query tuning


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

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Mon Apr 05, 2010 1:29 pm
Reply with quote

Hi,

I have a DB2 query for fetching transactions from multiple tables.The query is inbuilt in a COBOL pgm.The joins of the tables are in order of their primary key/indexes.Still the query is taking around 7 hours to execute.
May I request for any insight on how can I optimize this query.I also tried multi-row fetch but that won't help much.

Please let me know if putting up the query would help in providing the resolution.Thanks a lot.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Apr 05, 2010 1:41 pm
Reply with quote

from what I can see Your query works perfectly, I just tested a similar query and the results were
quick and dirty 4 days an 19 hours ( z/OS + DB2 )
after optimization ( praise to the system, I did not do anything really ) 9 hours ( OS/VU )

so You see, after all You were able to find a better optimization, congratulations
I am going to make a formal complaint to the OS/VU designers

I was able to post all this useful info ( along Your judgment of useful ) because today is psychic day,
and above all because I run a very smart operating system.. OS/VU

here is the optimized query

Code:
//seventhday exec pgm=iehprophet,parm='usetimewarp'
//steplib dd disp=resurrect,dsn=sys1.messiahscripts
//whatIwouldlike dd *
 run the query i have in mind in the shortest time -
 providing consistent results
//whereputtheresult dd subsys=I_will_let_you_know_when_I_remember

the usetimewarp parm offloads the long running tasks to a zTWP ( time warp processor )
in order to reduce the elapsed to a few minutes ( as You can see fro the reply timestamps )

the 4 days timing was obtained by using a zOS emulated machine under OS/VU

I wish I could tell the details, But I signed a NDA icon_sad.gif
Back to top
View user's profile Send private message
Ranjithkumar

New User


Joined: 10 Sep 2008
Posts: 93
Location: India

PostPosted: Mon Apr 05, 2010 4:41 pm
Reply with quote

@Kamlesh

Post the query please.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon Apr 05, 2010 4:46 pm
Reply with quote

Kamlesh Kamal wrote:
Please let me know if putting up the query would help in providing the resolution.

to summarize Enrico's answer : Duh !

the query, explain info and the definition/stats of the involved (or alternative) indexes
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 Apr 05, 2010 8:13 pm
Reply with quote

Only Monday morning and already another topic of the "my results are not acceptable, i don't want to post any specifics, and i want suggestions about how to improve my process" variety. . . icon_confused.gif

Maybe some of the requested info will be posted so someone might be able to help. . .

d
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