Query Plan
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: Query Plan

  1. #1
    Join Date
    Feb 2004
    Posts
    35

    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

  2. #2
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586
    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."

  3. #3
    Join Date
    Feb 2004
    Posts
    35
    Yes, both are 9.2.0.5.3 and stats are updated weekly.

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    So what do the statistics say about the tables? Give us ...

    Code:
    select * from user_tables
    where table_name in ('AAA','BBB')
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  5. #5
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586
    did you check your init.ora parameters for any differences? do a diff.
    "High Salaries = Happiness = Project Success."

  6. #6
    Join Date
    Nov 2001
    Posts
    335
    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!

  7. #7
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434

    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
  •  



Click Here to Expand Forum to Full Width