-
Query Plan
Hello,
One of my SQL is using two different execution paths in two different DB instances. The object definition, indexes etc. are same in both the instances. What could be the possible reason for the following discrepancy?
Query Plan in DB Instance 1:
Query Plan
------------------------------------------------------
SELECT STATEMENT Cost = 1180
HASH JOIN
TABLE ACCESS FULL Table_AAA
TABLE ACCESS FULL Table_BBB
Query Plan in DB Instance 2:
Query Plan
-----------------------
SELECT STATEMENT Cost = 1468
HASH JOIN
TABLE ACCESS FULL Table_BBB
TABLE ACCESS FULL Table_AAA
Thanks
-
Are both your databases same version? What about stats? when did you collect them? Different init.ora parameters would do it too. Indexes etc
"High Salaries = Happiness = Project Success."
-
Yes, both are 9.2.0.5.3 and stats are updated weekly.
-
So what do the statistics say about the tables? Give us ...
Code:
select * from user_tables
where table_name in ('AAA','BBB')
-
did you check your init.ora parameters for any differences? do a diff.
"High Salaries = Happiness = Project Success."
-
Check number of rows in each table in each instance .(DBA_TABLES-num_rows)
One, who thinks that the other one who thinks that know and does not know, does not know either!
-
Re: Query Plan
Originally posted by ADBA007
Query Plan in DB Instance 1:
Query Plan
------------------------------------------------------
SELECT STATEMENT Cost = 1180
HASH JOIN
TABLE ACCESS FULL Table_AAA
TABLE ACCESS FULL Table_BBB
Query Plan in DB Instance 2:
Query Plan
-----------------------
SELECT STATEMENT Cost = 1468
HASH JOIN
TABLE ACCESS FULL Table_BBB
TABLE ACCESS FULL Table_AAA
What difference it makes for an HASH JOIN operation if the table order are reveresed???.. Ofcourse if does a little bit for below 2 cases..
* Either of the tables is too small compared to other.
* Either of the tables involved have a limiting condition in the query which makes it virtually very small then other.
Well in your case it might not be the case, so oracle is thinking its immaterial if tab Table_AAA comes first or Table_BBB comes first ( For hashing the contents to be joined )..
Abhay.
funky...
"I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."
"Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|