Topic: Performance & Tuning >> Self join removal
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| Sri |
Posted: May 19, 2008 02:58:30 AM |
Total Post: 1
Joined: May, 2008
|
I have a performance issue with the following query due to self join and usage of Max function. The self joined table has 40 million records approx. We are using only about 2% to 3% of the total data in the table.
Please find below the query.
We have created unique index on (asset_id, pricing_pt_id, prc_dt, accept_flg).
SELECT max(tpm2.prc_dt), --previous prc_dt
tpm2.asset_id ,
tpm2.pricing_pt_id ,
tpm1.prc_dt --prc_dt
FROM t_prc_master tpm1,
t_prc_master tpm2
WHERE tpm1.prc_dt = 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'
GROUP BY tpm2.asset_id, tpm2.pricing_pt_id, tpm1.prc_dt;
Let me know is there any way to avoid max in the above query?
|
|
|
Murtuja |
| Posted: May 19, 2008 03:27:47 AM | |
|
Total Post: 843
Joined: Jan, 2006
|
Hi,
Read this link.
http://gennick.com/magic.html
|
|
|
|
|
GOPU |
| Posted: May 19, 2008 07:57:55 AM | |
|
Total Post: 272
Joined: Apr, 2008
|
If you know the problem is with the selfjoin and the use of MAx funcion.Then you know the solution also :)
|
|
|
|
|
GOPU |
| Posted: May 19, 2008 08:01:10 AM | |
|
Total Post: 272
Joined: Apr, 2008
|
The MAX funcion is required for you ??
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 843 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Gitesh Trivedi | 322 |
| Gopu Gopi | 272 |
| neeraj sharma | 252 |
| Ramesh Jois | 245 |
| Bishal Khetan | 207 |
|
|