Solved

Tuning Question

Posted on 2006-11-14
1
692 Views
Last Modified: 2008-02-01
select /*+ USE_MERGE(B,A) */ a.prod_id,
       a.prod_number,
       a.prod_name,
       a.update_date,
       b.term,
       b.term_type
  from merch a,
       term_details b
 where a.prod_id = b.prod_id

Experts,
  I just used TOAD to tune the following query and received this result as the best option. Before I use the code I wanted to understand what the solution was. I was hoping someone could explain the /* + USE_MERGE(B,A) */ comment? I don't want to use code and not fully understand what it's doing. Thanks!
0
Comment
Question by:ACSDBA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

by:
schwertner earned 500 total points
ID: 17938715
Causes Oracle to join each specified table with another row source with a sort-merge join.

http://www.psoug.org/reference/hints.html

Merge join
Also called sort merge join. A merge join basically sorts all relevant rows in the first table by the join key , and also sorts the relevant rows in the second table by the join key, and then merges these sorted rows. Take an example! At a garage sale you can buy 400 books. The deal is to take all or none. You take all. Now, you have to find the books that you already have at home. How would you go about it? Probably, you'd do a merge join: first, you sort your books by the primary key (author, title), then you sort the 400 books by their primary key (auther, title). Now, you start at the top of both piles. If the value of the left piles primary key is higher, then you take a book from the right pile and vice versa. When both values are equal, then you have found a dublicate. To demonstrate a MERGE JOIN, two tables need to be created: The behaviour of merge joins is influenced by the initialization parameters sort_area_size and db_file_mutliblock_read_count.

http://www.adp-gmbh.ch/ora/sql/join/join_methods.html
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle Insert not working 10 79
SYS password changed. Now can't log in as SYS 27 62
Oracle Errors 11 89
MS SQL Server Management Studio R2 4 60
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question