Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: type of join in sql

RE: type of join in sql

From: <Paula_Stankus_at_doh.state.fl.us>
Date: Tue, 06 Aug 2002 20:43:25 -0800
Message-ID: <F001.004AD288.20020806204325@fatcity.com>


It uses more then presence of indexes. It also looks at the sort_area_size and hash_area_size and hash...mutlblock... and even db_file..multi.. to determine how expensive/inexpensive a hash join might be versus a nested loops join. You can force a specific join type by using hints - there are hints for each type of join. Consider how much data, how much data would be joined from each table, whether you are running in parallel or not. Oh yeah, the CBO will consider parallelism if you have it setup I believe which may cause it to choose a different type of join.

-----Original Message-----
Sent: Wednesday, July 24, 2002 10:13 AM
To: Multiple recipients of list ORACLE-L

The optimizer will use the availability of indexes in deciding which type of join to use.
no indexes = merge join
indexes = nested loops, although the optimizer may dynamically choose to perform a hash join.  

Your tweaking of the join conditions is what causes the different joins to be used.  

HTH   p.s. See the "Database Performance Guide and Reference" section of the docs. for more info.  

-----Original Message-----
Sent: Tuesday, July 23, 2002 9:59 PM
To: Multiple recipients of list ORACLE-L

can some body shed some light on how does the optimizer decides to choose the kind of join i.e. nested loop, sort merge or hash join . In one of queries if i tweak the join condition it changes the type of join and start using index , otherwise it doesn't .
I thought it depends on statistics .. if optimize finds that are more qualifying records in inner table then it will prefer to go for sort merge and will do full scan of inner table , but if it thinks there are less records in inner table it will user nested loop . am I correct ?  

TIA ,
bp  

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: Paula_Stankus_at_doh.state.fl.us

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Aug 06 2002 - 23:43:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US