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

Performance Tuning of Db2 Query


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

New User


Joined: 16 Mar 2007
Posts: 3
Location: India

PostPosted: Thu May 17, 2007 9:38 am
Reply with quote

We have 3 cursors in a program as follows:

open cursor1
Fetch the records
do when not sqlcode 100
open cursor2
fetch cursor2
process
close cursor2

open cursor3
fetch cursor3
process
close cursor3
end do
close cursor1
Write to an output file.

We have to reduce the time taken for excution. It takes atleast 20 mins to execute the program.
Will the Option of Opening all the cursors at one time, processing the record set and then at end close all the cursors instead of Open, fetch and close help?
Is there any other way?
Please let me know.
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Sat May 19, 2007 9:15 pm
Reply with quote

first two cursors can be comnined to one. because 2nd is depend on 1st one.

the third cursor is like a stand alone cursor. this can be modified depending on the actual functionality of the program.
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: Tue May 22, 2007 5:31 am
Reply with quote

Hello,

How many rows need to be fetched from each table for processing this program?

How many of the predicates are via a key/index?

What do the select statements with the 3 curssors look like?

How often and at what time(s) is this program run?
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 exploiting Z16 performance PL/I & Assembler 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
Search our Forums:

Back to Top