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

db2 cursors and performance of the program


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

New User


Joined: 29 Nov 2006
Posts: 19
Location: amsterdam

PostPosted: Sat Mar 03, 2007 10:12 pm
Reply with quote

My program uses 10 cursors. There is one main cursor and the rest of the 9 cursors are opened, fetched and closed for each row retrieved from the main cursor.

We have tested the program using 200 records, but did not find any significant performance issue.

Please advise or let me know any literature that mentions the tips of using cursors in mainframe db2 programs to optimize performance of the program

Thanks
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sun Mar 04, 2007 4:29 am
Reply with quote

READ THIS
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: Sun Mar 04, 2007 7:56 am
Reply with quote

Hello,

CURSORs are neither good nor bad - they are just a tool.

The performance of the cursor is largely dependent on how many times it is executed (look at the referred post) and/or how large the resulting "found set" that will be returned. The query within the cursor is where performance may be improved or degraded.

Sometimes, the best solution is using a cursor - other times not even using SQL is a better solution (again, see the referred post).

Keep us posted icon_smile.gif
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Tue Mar 06, 2007 3:47 pm
Reply with quote

Use EXPLAIN and figure out the performance of each query. Are the queries going for Index scan or Tablespace scan. Obviously 200 records cannot make much difference even if it goes to tablespace scan.
Get in touch with DBA to find the optimisation path. Are the indexes being used effectively..? Check the conditions in the WHERE predicate of all the queries. If applicable change some BIND parameters.
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 Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts exploiting Z16 performance PL/I & Assembler 2
Search our Forums:

Back to Top