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

Tweaking SQL performance


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

New User


Joined: 29 Apr 2005
Posts: 21
Location: Gurgaon, India

PostPosted: Fri Oct 03, 2008 3:36 am
Reply with quote

Hi,

Please suggest which of the following is a better option for Cobol DB2 batch program.

1. Open cursor-A, fetch data from cursor-A. Now, use data from cursor-A to execute another SQL like:
EXEC SQL
SELECT SUM(COL_A * COL_B)
FROM TABLE-B
WHERE COL_C = ....
END-EXEC

2. Open cursor-A, fetch data from cursor-A. Now, use data from cursor-A to open another cursor-B like:
EXEC SQL
DECLARE CURSOR_B AS
SELECT COL_A, COL_B
FROM TABLE-B
WHERE COL_C = ....
END-EXEC
and then do sum of multiplication in Cobol.

Data volume could be around 50,000 to 80,000

Please suggest.

Thanks,
Rohin
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Fri Oct 03, 2008 2:57 pm
Reply with quote

Why dont you join TABLE-B with the first cursor and do the multiplication in the cursor itself .... Multiplication in DB2 query is not going to eat up CPU time ...
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 exploiting Z16 performance PL/I & Assembler 2
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Which SORT utility can improve the Pe... DFSORT/ICETOOL 16
No new posts COBOL Performance Tuning COBOL Programming 6
No new posts CICS Performance statistics CICS 3
Search our Forums:

Back to Top