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
 

 

Tweaking SQL performance

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Tweaking SQL performance
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    Post subject:
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    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 CONTIG for performance? JPVRoff JCL & VSAM 7 Fri Jun 09, 2017 8:39 am
No new posts BC, BCR, BRC, BRCL performance steve-myers PL/I & Assembler 0 Fri Dec 23, 2016 7:44 am
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What are the way we can improve CPU p... Gunapala CN DB2 10 Mon Oct 24, 2016 2:16 pm
No new posts DISP=(SHR,PASS) performance opinion steve-myers JCL & VSAM 1 Wed Dec 02, 2015 11:53 pm


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