View previous topic :: View next topic
|
Author |
Message |
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
Back to top |
|
|
Ranjithkumar
New User
Joined: 10 Sep 2008 Posts: 93 Location: India
|
|
|
|
@Kamlesh
Post the query please. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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. . .
Maybe some of the requested info will be posted so someone might be able to help. . .
d |
|
Back to top |
|
|
|