DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 10th, 2007, 09:39 PM
chandra131 chandra131 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 2 chandra131 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 50 sec
Reputation Power: 0
Arrow Help me on Query fine tune.Explain report details provided.

Hello,

Thankyou for helping me.

Here we have two quires on same table , but FROM classs differs.
But both quiries uses the same INDEX.I have provided the index details below.Is there any chances to improve performance.
Please help me. Thank you.

STATEMENET :1
---------------------------
SELECT DRMT_DET_PAR_NBR
,DRMT_SYS_ID
,DRMT_DET_PAR_DTE
,DRMT_DR_CR_IND
,DRMT_DET_AMT
,DRMT_ACH_TRAN_CD
,DRMT_DIST_ACCT_NBR
,DRMT_ORIG_ACCT_NBR
INTO :DCLCH-DET-RTN-MTCH.DRMT-DET-PAR-NBR, :DCLCH-DET-RTN-MTCH
.DRMT-SYS-ID, :DCLCH-DET-RTN-MTCH.DRMT-DET-PAR-DTE, :
DCLCH-DET-RTN-MTCH.DRMT-DR-CR-IND, :DCLCH-DET-RTN-MTCH.
DRMT-DET-AMT, :DCLCH-DET-RTN-MTCH.DRMT-ACH-TRAN-CD, :
DCLCH-DET-RTN-MTCH.DRMT-DIST-ACCT-NBR, :
DCLCH-DET-RTN-MTCH.DRMT-ORIG-ACCT-NBR
FROM CH_DET_RTN_MTCH
WHERE DRMT_DET_PAR_NBR = :DCLCH-DET-RTN-MTCH.DRMT-DET-PAR-NBR
AND DRMT_SYS_ID = :DCLCH-DET-RTN-MTCH.DRMT-SYS-ID
AND DRMT_DET_PAR_DTE = :DCLCH-DET-RTN-MTCH.DRMT-DET-PAR-DTE
AND DRMT_DR_CR_IND = :DCLCH-DET-RTN-MTCH.DRMT-DR-CR-IND
AND DRMT_DET_AMT = :DCLCH-DET-RTN-MTCH.DRMT-DET-AMT
AND DRMT_DIST_SETT_DTE >= :DCLCH-DET-RTN-MTCH.

EXPLAIN REPORT :
----------------------------

QB PL MIX QTYPE METH ACC MTCH IX TBNAME IXNAME
1 1 0 SELECT 0 I 3 N CH_DET_RTN_MTCH X1CHDRMT

NU J O G CU J O G LCK
N N N N N N N N IS


STATEMENET :2
---------------------------


SELECT DRMT_DET_PAR_NBR
,DRMT_SYS_ID
,DRMT_DET_PAR_DTE
,DRMT_DR_CR_IND
,DRMT_ACH_TRAN_CD
,DRMT_DIST_ACCT_NBR
,DRMT_ORIG_ACCT_NBR
INTO :DCLCH-DET-RTN-MTCH.DRMT-DET-PAR-NBR, :DCLCH-DET-RTN-MTCH
.DRMT-SYS-ID, :DCLCH-DET-RTN-MTCH.DRMT-DET-PAR-DTE, :
DCLCH-DET-RTN-MTCH.DRMT-DR-CR-IND, :DCLCH-DET-RTN-MTCH.
DRMT-ACH-TRAN-CD, :DCLCH-DET-RTN-MTCH.DRMT-DIST-ACCT-NBR,
:DCLCH-DET-RTN-MTCH.DRMT-ORIG-ACCT-NBR
FROM CH_DET_RTN_MTCH
WHERE DRMT_DET_PAR_NBR = :DCLCH-DET-RTN-MTCH.DRMT-DET-PAR-NBR
AND DRMT_SYS_ID = :DCLCH-DET-RTN-MTCH.DRMT-SYS-ID
AND DRMT_DET_PAR_DTE = :DCLCH-DET-RTN-MTCH.DRMT-DET-PAR-DTE
AND DRMT_DR_CR_IND = :DCLCH-DET-RTN-MTCH.DRMT-DR-CR-IND
AND DRMT_DIST_SETT_DTE >= :DCLCH-DET-RTN-MTCH.

EXPLAIN REPORT :
----------------------------
QB PL MIX QTYPE METH ACC MTCH IX TBNAME IXNAME
1 1 0 SELECT 0 I 3 N CH_DET_RTN_MTCH X1CHDRMT

NU J O G CU J O G LCK
N N N N N N N N IS

Index Key Information for: X1CHDRMT
-------------------------------------------------------
COLUMN NAME COLNO COLSEQ ORDERING
DRMT_SYS_ID 1 1 ASCENDING
DRMT_DET_PAR_NBR 2 2 ASCENDING
DRMT_DIST_SETT_DTE 3 3 ASCENDING
DRMT_DET_AMT 4 4 ASCENDING
DRMT_DR_CR_IND 5 5 ASCENDING
DRMT_CBAT_CO_ID 6 6 ASCENDING
DRMT_DET_PAR_DTE 7 7 ASCENDING

Reply With Quote
  #2  
Old August 11th, 2007, 01:42 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 25th Plane (17000 - 17499 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,344 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 5 Days 8 h 26 m 4 sec
Reputation Power: 891
actually, the FROM clause is the same -- the only difference between the two queries is that the second query retrieves one less field

and both queries use the same index, yes?

but since that field is the 4th column in the index, and you're providing a value for it in the first query but not the second, i would expect the first query to run faster than the second

to make it run even faster, provide a value for DRMT_CBAT_CO_ID as well

is that what you're after?

by the way, this doesn't look like mysql, i'm going to move the thread to the db2 forum
__________________
r937.com | rudy.ca

Reply With Quote
  #3  
Old August 11th, 2007, 09:27 AM
chandra131 chandra131 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 2 chandra131 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 50 sec
Reputation Power: 0
Thanks for your advice.
Both queires different in WHERE clause but uses the same TABLE and same INDEX.

Here my question is Can i improve performance by

1.create another index ?
2.by changing WHERE clause field sequance, based on index key field sequance ? will it improve performance ?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > Help me on Query fine tune.Explain report details provided.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway