MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DB2 performance question.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Mon Jan 22, 2007 6:19 am    Post subject: DB2 performance question. Reply with quote

Can you tell me if it is more efficient to do this via DB2 query or outside Db2 query in the program.

The number of records in table run into million. Amount is a packed decimal.

Quote:
Select (amount1-amount2) as calcamt from table
where (amount1 -amount2) > 0;


or

Quote:
Select amount1, amount2 from table;
In program:
If (amount1-amount2)..


Regards, Relaxing.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Jan 22, 2007 6:40 am    Post subject: Reply with quote

effecient? ok, you have > million rows.

you are still going to have a results table(meaning your need a cursor), unless you do a SUM.
But since SUM is so obvious, I assume you will be selecting other rows for some processing????

perform an EXPLAIN on both SQL. variances between shops (i.e. size of box, how is DB2 allocated, table layout, indexes, load on machine > available cpu for DB2) means that it is conceivable, one will run faster here, the other, faster, there.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group