Hi,
I am running a query which uses a view and also there is a sub-query in this query. This query took about 120 secs to execute. I queried dba_tables to check for chain_cnt and found that 2 tables have chain_cnt of 224 and 7067 resp.
I deleted the chained rows and analyzed the 2 tables again. Now, the query takes about 65 secs to execute. It fetches 1788 records. But, I am not sure if it is because of the deletion of chained rows or not. Again if I execute the same query it will take more time to execute.
Any other way or method to make the query run faster?
select VTS.CLNT_ENT_NM,
VTS.CLNT_ID,
VTS.CUST_NM,
VTS.CUST_NO,
VTS.ACCT_NO,
VTS.ACCT_ID,
VTS.CUST_REF,
VTS.BNK_REF,
VTS.BNK_NM,
VTS.VAL_DT,
VTS.ENT_DT,
VTS.TRD_ENT_DT,
VTS.STMT_DT,
VTS.LAST_ENT_DT,
VTS.CR_D_IND,
VTS.PMT_TYP,
VTS.PROD_TYP,
VTS.PROD_TYP_DES,
VTS.PMT_DETL,
VTS.FTHR_REF,
VTS.ACCT_NM,
VTS.BR_COD,
VTS.BRN_NM,
VTS.TRAN_CCY,
VTS.TRAN_AMT,
VTS.TRAN_NO,
VTS.BENE,
VTS.TRAN_TYP,
VTS.BR_TAX_ID,
VTS.DETAIL,
VTS.ACT_ONLY,
VTS.AS_OF_DT,
VTS.LEGAL_TEXT,
VTS.TOTAL,
VTS.BASE_TRAN_AMT,
VTS.BASE_CCY,
VTS.LANG_ID,
VTS.BATCH_NO,
VTS.SWIFT_TRAN_CD,
VTS.SERIAL_NO,
VTS.GFCID,
VTS.CUST_BAS_NO,
VTS.CUST_PTY_ID,
VTS.TRAN_COD,
VTS.BR_PTY_ID
from VW_TRAN_SMRY VTS
WHERE ( VTS.LANG_ID = 'en_US'
AND VTS.BR_COD = '862'
AND VTS.ENT_DT between to_date('20011103000000', 'YYYYMMDDHH24MISS')
and to_date('20020214235959', 'YYYYMMDDHH24MISS')
AND VTS.VAL_DT between to_date('20011103000000', 'YYYYMMDDHH24MISS')
and to_date('20020214235959', 'YYYYMMDDHH24MISS')
AND VTS.BASE_CCY = 'USD'
AND VTS.CLNT_ID = 52325434
and exists (select 'x' from ENTITLEMENT_PRIVILEGE ENT,
ENT_USER_PROFILE_LINK EUPL
where rownum < 2
and ( ENT.CashPIbrcod = CHR(26)
or VTS.BR_COD = ENT.CashPIbrcod
or VTS.BR_COD is null)
and ( ENT.CashPIaccount = CHR(26)
or VTS.ACCT_ID = ENT.CashPIaccount
or VTS.ACCT_ID is null)
and ( ENT.CashPIcustno = -1001
or VTS.CUST_PTY_ID = ENT.CashPIcustno
or VTS.CUST_PTY_ID is null)
and ENT.status_type = 'PROCESSED'
AND EUPL.STATUS_TYPE = 'PROCESSED'
AND EUPL.PROFILE_ID = ENT.PROFILE_ID
AND ENT.STATUS_TYPE = 'PROCESSED'
AND ENT.SERV_CLAS_TYP = 'GENCASHPI'
AND EUPL.user_id = 117022 ))
ORDER BY VTS.ACCT_NO ASC ,
VTS.VAL_DT ASC
(decode(e6.math_actn,'M',(decode(e1.math_actn,'M',1 * e1.conv_rt,1 / e1.conv_rt))/
e6.conv_rt,(decode(e1.math_actn,'M',1 * e1.conv_rt,1 / e1.conv_rt))*e6.conv_rt) )))))*
DECODE(t1.cr_dr_mrk, 'D ' , -1.0*t1.tran_amt,
'RC', -1.0*t1.tran_amt,t1.tran_amt)
as base_tran_amt,
bc.iso_ccy_cod as base_ccy,
2 as tran_ccy_deci_plac,
rc1.batch_no as batch_no,
t1.swift_tran_cod as swift_tran_cd,
rc1.chq_ser_no as serial_no,
as1.br_pty_id as br_pty_id
where as1.acct_id = s1.acct_id and
s1.acct_sta_typ = 'PROCESSED' and
-- as1.acct_sta_typ = s1.acct_sta_typ and
s1.acct_id = t1.acct_id and
s1.stmt_no = t1.stmt_no and
s1.actv_ind = 'Y' and
t1.backval_ind is null and
t1.tran_no = tp1.tran_no(+) and
tp1.tpty_typ(+) = 'BENE' and
t1.tran_no = tp2.tran_no(+) and
tp2.tpty_typ(+) = 'ORDPTY' and
t1.tran_no = rc1.tran_no(+) and
as1.br_pty_id = b1.pty_id and
b1.pty_sta_typ = 'PROCESSED' and
-- as1.pty_sta_typ = b1.pty_sta_typ and
t1.iso_ccy_cod = e1.iso_ccy_cod(+) and
e1.bas_ccy_cod(+) = 'USD' and
e2.bas_ccy_cod(+) = 'USD' and
e1.prod_src_typ(+) = 'MCP' and
e2.prod_src_typ(+) = 'MCP' and
e1.actv_ind(+) = 'Y' and
e2.actv_ind(+) = 'Y' and
e2.iso_ccy_cod(+) = bc.iso_ccy_cod and
e3.bas_ccy_cod(+) = 'EUR' and
e3.prod_src_typ(+) = 'EMU' and
e3.actv_ind(+) = 'Y' and
e3.iso_ccy_cod(+) = bc.iso_ccy_cod and
e4.bas_ccy_cod(+) = 'EUR' and
e4.prod_src_typ(+) = 'EMU' and
e4.actv_ind(+) = 'Y' and
e4.iso_ccy_cod(+) = t1.iso_ccy_cod and
-- CHECK NYRS IF MCP MISSING 6/27/01 CHANGE T. HINES
e5.iso_ccy_cod(+) = t1.iso_ccy_cod and
e5.bas_ccy_cod(+) = 'USD' and
e5.prod_src_typ(+) = 'NYRS' and
e5.exch_rt_typ(+) = 'SPOT' and
e5.actv_ind(+) = 'Y' and
e6.bas_ccy_cod(+) = 'USD' and
e6.prod_src_typ(+) = 'NYRS' and
e6.exch_rt_typ(+) = 'SPOT' and
e6.actv_ind(+) = 'Y' and
e6.iso_ccy_cod(+) = bc.iso_ccy_cod and
t1.prod_typ = tve1.typ_val(+) and
tve1.typ_def(+) = 'PROD_TYP' and
tve1.lang_id(+) = 'en_US' and
((t1.prod_typ = tvm1.typ_val or
tvm1.typ_val is null ) and
tvm1.typ_def(+) = 'PROD_TYP' and
tvm1.lang_id(+) = lg.lang_id )) A,
type_values tve2,
type_values tvm2,
Transaction_code tcm
, Transaction_code tce
where A.swift_tran_cd = tve2.typ_val(+)
and tve2.typ_def(+) = 'SWIFTTRAN'
and tve2.lang_id(+) = 'en_US'
and (
A.swift_tran_cd = tvm2.typ_val(+)
and tvm2.typ_def(+) = 'SWIFTTRAN'
and tvm2.lang_id(+) = A.lang_id )
and tcm.tran_cod(+) = A.tran_cod
and tcm.lang_id(+) = A.lang_id
and tcm.pty_id(+) = A.brn_id
and TCM.TRAN_COD_STA_TYP(+) = 'PROCESSED'
and TCM.PTY_STA_TYP(+) = 'PROCESSED'
and tcm.lang_id(+) <> 'en_US'
and tcm.tran_cod(+) <> 'MSC'
and tce.tran_cod(+) = A.tran_cod
and tce.pty_id(+) = A.brn_id
and tce.TRAN_COD_STA_TYP(+) = 'PROCESSED'
and tce.PTY_STA_TYP(+) = 'PROCESSED'
and tce.lang_id(+) = 'en_US'
and tce.tran_cod(+) <> 'MSC'
Account_scpn table has 38162 rows.
rds_statement has 334709 rows.
rds_transaction has 1908111 rows.
branch has 265 rows
vw_language has 27 rows
rds_thrd_pty_info has 100866 rows
rds_remote_checking has 1354873 rows
currency has 208 rows
exchange_rate has 60827 rows
type_values has 42052 rows.
Bookmarks