Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DB2 query tuning

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: DB2 query tuning
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Mon Apr 05, 2010 1:41 pm    Post subject: Reply to: DB2 query tunning
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: 94
Location: India

PostPosted: Mon Apr 05, 2010 4:41 pm    Post subject: Reply to: DB2 query tuning
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: 1278
Location: Belgium

PostPosted: Mon Apr 05, 2010 4:46 pm    Post subject: Re: DB2 query tuning
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

Site Director


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

PostPosted: Mon Apr 05, 2010 8:13 pm    Post subject: Reply to: DB2 query tuning
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us