If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Help in fine tunning the query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-18-10, 02:53
surjyakp surjyakp is offline
Registered User
 
Join Date: Jan 2010
Posts: 26
Help in fine tunning the query

Hi,
My application uses the below query
SELECT TXN_DT, INTEGER (CLNT_SRF_NO) AS CLNT_SRF_NO,(TXN_AMT * EXCH_RT) AS TXN_AMT FROM PQ5.SRVC_PLATF_CLNT_TXN_DTL
UNION ALL
SELECT TXN_DT, INTEGER (CLNT_SRF_NO) AS CLNT_SRF_NO,(TXN_AMT * EXCH_RT) AS TXN_AMT FROM PQ5.ABM_DEP_TXN_DTL
UNION ALL
SELECT TXN_DT, INTEGER (CLNT_SRF_NO) AS CLNT_SRF_NO , (TXN_AMT * EXCH_RT) AS TXN_AMT FROM PQ5.HSCP_DEP_TXN_DTL

It takes very much time, please provide soem input to fine tune the query.

Thanks
Surjya
Reply With Quote
  #2 (permalink)  
Old 11-18-10, 06:59
Marcus_A Marcus_A is online now
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Since there is no WHERE clause in the queries, it is having to read and return every row in each table. How many rows are there in each table?
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 11-18-10, 08:18
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
As Marcus mentioned, no where clause not much to improve. The only thing that may help is to create an index on the four columns you are after. Depending on the version you are running you may want to create and index on expressions, meaning the column definition would be:
Quote:
TXN_DT, INTEGER (CLNT_SRF_NO) AS CLNT_SRF_NO , (TXN_AMT * EXCH_RT) AS TXN_AMT
Dave
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On