relaxing Beginner
Joined: 25 Aug 2003 Posts: 73 Topics: 29
|
Posted: Mon Jan 22, 2007 6:19 am Post subject: DB2 performance question. |
|
|
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. |
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Mon Jan 22, 2007 6:40 am Post subject: |
|
|
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 |
|