Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Tuning Question

Posted on 2006-11-14
1
Medium Priority
?
704 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
1 Comment
 
LVL 48

Accepted Solution

by:
schwertner earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Suggested Courses

971 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