473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

I need help to fine tune below query..urgent please.

Query used in cursor:

DECLARE CURSOR2 CURSOR FOR
SELECT TDET_DET_PAR_NBR
,TDET_SYS_ID
,TDET_DR_CR_IND
,TDET_DET_AMT
,TDET_DIST_SETT_DTE
,TDET_FILE_ID_NBR
,TDET_CBAT_ID_NBR
,TDET_FILE_COL_DTE
,TDET_FILE_SYS_ID
,TDET_ACH_TRAN_CD
,TDET_INDV_INFO_TXT
,TDET_DIST_ACCT_NBR
,TDET_ORIG_ACCT_NBR
,TDET_SEC_CD
,TDET_DET_PAR_DTE
,CBAT_HDR_CO_ID
FROM CH_P_TRANDET, CH_P_COLL_BTCH
WHERE TDET_DET_PAR_NBR = :TDET-DET-PAR-NBR
AND TDET_SYS_ID = :TDET-SYS-ID
AND TDET_DR_CR_IND = :TDET-DR-CR-IND
AND TDET_DET_AMT = :TDET-DET-AMT
AND TDET_DIST_SETT_DTE >= :TDET-DIST-SETT-DTE
AND TDET_FILE_ID_NBR = CBAT_FILE_ID_NBR
AND TDET_CBAT_ID_NBR = CBAT_ID_NBR
AND TDET_FILE_COL_DTE = CBAT_FILE_COL_DTE
AND TDET_FILE_SYS_ID = CBAT_FILE_SYS_ID
AND TDET_FILE_TYPE_CD = CBAT_FILE_TYPE_CD
AND TDET_FILE_SYS_ID = CBAT_FILE_SYS_ID
AND CBAT_HDR_CO_ID = :CBAT-HDR-CO-ID
--> ORDER BY TDET_DIST_SETT_DTE
FOR FETCH ONLY END-EXEC. "

INDEX DETAILS.

Table CH_P_TRANDET indexes:

X1CHTDET (UNIQUERULE R)

TDET_DET_PAR_NBR
TDET_SYS_ID
TDET_DET_PAR_DTE

X2CHTDET (UNIQUERULE U)

TDET_CBAT_ID_NBR
TDET_FILE_ID_NBR
TDET_FILE_COL_DTE
TDET_FILE_TYPE_CD
TDET_FILE_SYS_ID
TDET_SYS_ID
TDET_DET_PAR_DTE
TDET_DET_PAR_NBR
TDET_EXCP_STAT_CD

"Table CH_P_COLL_BTCH indexes:

X1CHCBAT (UNIQUERULE P)

CBAT_ID_NBR
CBAT_FILE_ID_NBR
CBAT_FILE_COL_DTE
CBAT_FILE_TYPE_CD
CBAT_FILE_SYS_ID

X2CHCBAT (UNIQUERULE U)

CBAT_POINT_NME
CBAT_FILE_SYS_ID
CBAT_FILE_COL_DTE
CBAT_FILE_ID_NBR
CBAT_ID_NBR
CBAT_FILE_TYPE_CD
CBAT_COLL_APPL_ID
CBAT_COLL_TYPE_CD

X3CHCBAT (UNIQUERULE U)

CBAT_HDR_CO_ID
CBAT_FILE_SYS_ID
CBAT_FILE_COL_DTE
CBAT_FILE_ID_NBR
CBAT_ID_NBR
CBAT_FILE_TYPE_CD
CBAT_HDR_EFF_DTE
CBAT_SRCE_CD "
Aug 3 '07 #1
2 1744
Difficult to do without some stats. It would appear that a 2-column matching index scan on X1CHTDET is the most probable access path with a nested loop join to CH_P_COLL_BTCH using X1CHCBAT.

Changing X1CHTDET and adding DR_CR_IND, TDET_DET_AMT and DET_DIST_SETT_DTE as the 3rd, 4th and 5th columns (before TDET_DET_PAR_DTE) would improve selectivity of the index but this may not be an option.

Ensure runstats has been run on the tables and indexes and run db2expln on this statement.
Aug 3 '07 #2
Thank you..i will come back with EXPLAIN report..Thank you for your reply..
Aug 3 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: phillip.s.powell | last post by:
UPDATE redesign.student SET student_work_area_other SELECT REPLACE('anywhere,(.*)', '$1', i.work_area) AS regexp_col FROM mycompany.interns i, redesign.student s WHERE i.unique_key = s.unique_key...
2
by: deependrapathak | last post by:
Hi All, I am currently facing a crutial problem in Access2003 in Windows XP on just 3 PCs, the Application throws some of the errors specified below : 1. Error Number : 3075 Function is not...
8
by: rshivaraman | last post by:
Hi : I have a TableA with around 10 columns with varchar and numeric datatypes It has 500 million records and its size is 999999999 KB. i believe it is kb i got this data after running...
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: id ------------ name
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: ----------------
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: ----------------
0
by: chandra131 | last post by:
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...
1
by: veerunrt | last post by:
Hi All, one column is having no of values separated by comma in the table that any one value should match with some other column of another table one value how to join in oracle I need result...
5
by: Justin | last post by:
Here's my XML: <?xml version="1.0" ?> <AppMode Type="Network"> <CurrentFolder Path="c:\tabs"> <Tabs> <FilePath>tabs\Justin.tab</FilePath> <FilePath>tabs\Julie.tab</FilePath> *****There could...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.