Performance tuning of SQL query [message #294114] |
Wed, 16 January 2008 09:04 |
mrosireddy
Messages: 1 Registered: January 2008
|
Junior Member |
|
|
Hi the follwoing query is taking lot of time.
the t_prc_master table has more than 8lakhs records.how can we tune further to get the same result set.
SELECT max(tpm2.prc_dt),
tpm2.asset_id ,
tpm2.pricing_pt_id ,tpm1.prc_dt
FROM t_prc_master tpm1,
t_prc_master tpm2,
t_pricing_pt_grp_assign ptg,
t_pricing_pt pt
WHERE to_date(to_char(tpm1.last_chg_dt,'mm/dd/YYYY'),'mm/dd/yyyy') = report_date_
AND tpm1.asset_id = tpm2.asset_id
AND tpm1.pricing_pt_id = tpm2.pricing_pt_id
AND tpm2.prc_dt < tpm1.prc_dt
AND tpm2.accept_flg = 'Y'
AND tpm1.accept_flg = 'Y'
AND tpm1.pricing_pt_id = ptg.pricing_pt_id
AND ptg.pricing_pt_id = pt.pricing_pt_id
AND ptg.pricing_pt_grp_id = pricing_pt_grp_id_
AND ( pricing_pt_id_ is null OR
pricing_pt_id_ = -1 OR
tpm1.pricing_pt_id = pricing_pt_id_ )
GROUP BY tpm2.asset_id, tpm2.pricing_pt_id,tpm1.prc_dt;
Thanks in advance.
|
|
|
|